Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support mapping output type of ref:(...) as a reference #333

Open
ronaldtse opened this issue Feb 21, 2025 · 0 comments
Open

Support mapping output type of ref:(...) as a reference #333

ronaldtse opened this issue Feb 21, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@ronaldtse
Copy link
Contributor

ronaldtse commented Feb 21, 2025

There are occasions where a serialization is not meant to serialize child attributes as objects, but as references.

class Publication < Lutaml::Model::Serializable
  attribute :id, :string
  attribute :related_items, ref(Publication, :id), collection: true
end
books:
- id: doi-1234
  title: This is a Book
  related_items:
    - doi-2345
    - doi-3456
- id: doi-2345
  title: This is also a Book
  related_items:
    - doi-1234

This was last encountered when a reference to a parent was needed:

It makes me wonder if ref: is an "attribute value type" or a "mapping value type"?

@ronaldtse ronaldtse added the enhancement New feature or request label Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants