-
Notifications
You must be signed in to change notification settings - Fork 162
Add support for inlining multivalued slots as dictionaries in JSON-Schema generation #411
Description
Currently in jsonschemagen inlining of multivalued slots is assumed to be as a list.
i.e we can generate jsonschema that validates:
{"persons":
[
{
"name": "Bob",
"age": 42,
"gender": "male"
},
{
"name": "Alice",
"age": 37,
"gender": "female"
}
]
}however, linkml supports inlining as dicts
See https://linkml.io/linkml/schemas/inlining.html for inlining docs
here the identifier slot is used as a key, and the presence of the identifier is optional in the body of the dict
{"persons":
{
"Bob": {
"age": 42,
"gender": "male"
},
"Alice": {
"age": 37,
"gender": "female"
}
}
}however, currently jsonschemagen ignores the distinction between list and dict inlining, and always inlines as lists.
This has not been a problem for many schemas "in the wild" since inlining as lists is more common. But it does mean that currently the linkml metamodel (which uses inlining as dict extensively) does not self-validate
To support this the jsonschemagen will need to use the pattern described here: