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

Include unspecified additional properties in structure layout. #59

Open
timothee-haudebourg opened this issue Oct 31, 2022 · 0 comments
Labels
enhancement New feature or request scope:gen:json-schema Related to the JSON Schema generator scope:syntax Related to the syntax of TreeLDR

Comments

@timothee-haudebourg
Copy link
Collaborator

For now TreeLDR structure layouts are composed of a list of expected fields. Additional unspecified fields appearing in an instance of such layout will be rejected (and an error raised). However it is sometime useful to capture additional unspecified fields in the layout, for instance like so:

layout Resource for rdf:Resource {
  rdfs:label: String,
  * as anyOtherProperty: rdf:Resource
}

This special * field will catch any additional property in a map in the generated code, here in Rust:

struct Resource {
  label: Option<String>,
  any_other_property: HashMap<Id, Resource>
}
@timothee-haudebourg timothee-haudebourg added enhancement New feature or request scope:syntax Related to the syntax of TreeLDR scope:gen:json-schema Related to the JSON Schema generator labels Oct 31, 2022
@timothee-haudebourg timothee-haudebourg self-assigned this Nov 11, 2022
@timothee-haudebourg timothee-haudebourg removed their assignment Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request scope:gen:json-schema Related to the JSON Schema generator scope:syntax Related to the syntax of TreeLDR
Projects
None yet
Development

No branches or pull requests

1 participant