microbiomedata / nmdc-schema

National Microbiome Data Collaborative (NMDC) unified data model
https://microbiomedata.github.io/nmdc-schema/
Creative Commons Zero v1.0 Universal
26 stars 8 forks source link

Use `--include-range-class-descendants` flag in JSON Schema generator calls #2083

Closed pkalita-lbl closed 1 week ago

pkalita-lbl commented 1 week ago

These changes are related to the issues uncovered while trying to integrate nmdc-schema@10.5.4 into nmdc-runtime (https://github.com/microbiomedata/nmdc-runtime/pull/560)

The immediate cause of the problem was that the WorkflowExecutionActivity class became abstract while still being used as the range of the activity_set slot. This isn't necessarily wrong from a modeling perspective, but it does cause some confusing in LinkML's JSON Schema generator. The generator is more equipped to handle this situation when the --include-range-class-descendants flag is used. This flag instructs the generator to do more work in flattening out the class hierarchy in defined in the LinkML schema when going to the JSON Schema representation (which has no concept of class hierarchy). Arguably this should be the default for the JSON Schema generator, but I need to work that out on the LinkML side.

These changes also add a new unit test that make sure that both JSON Schema artifacts generated from the schema are compatible with the fastjsonschema library that nmdc-runtime uses. This will give us an earlier failure if something similar crops up again.

github-actions[bot] commented 1 week ago

PR Preview Action v1.4.7 :---: :rocket: Deployed preview to https://microbiomedata.github.io/nmdc-schema/pr-preview/pr-2083/ on branch gh-pages at 2024-06-20 20:22 UTC