linkml / linkml

Linked Open Data Modeling Language
https://linkml.io/linkml
Other
326 stars 101 forks source link

Extend "gen-json-schema" to support JSON-LD #2295

Open Silvanoc opened 3 months ago

Silvanoc commented 3 months ago

What is your feature request? As of now gen-json-schema can generate JSON-Schema to validate data in JSON format that is not JSON-LD. If the data are in JSON-LD format, then the presence of the @type makes the validation fail.

How important is this feature to you? Select from the options below: • Medium - can do work without it; but it's important (e.g. to save time or for convenience)

Additional context linkml-validate can validate both JSON and JSON-LD, but we have a project using some standard tools for validation that would like to rely on pure JSON-Schema. I suppose that linkml-validate using the JsonschemaValidationPlugin is somehow generating the right JSON-Schema, so the needed code should be somewhere available...

Silvanoc commented 3 months ago

I wonder if it is meaningful to have separate JSON and JSON-LD JSON-Schemas or to have one covering JSON-LD with the specific properties (like @type, @context) being optional.