Open pkalita-lbl opened 5 months ago
Oof this isn't as straightforward as I thought. Unfortunately we use not one but two different JSON Schema libraries in nmdc-runtime
: the jsonschema
package (like here) and the fastjsonschema
package (like here).
Three options to move forward:
fastjsonschema
. Can't do that because unfortunately it doesn't support JSON Schema Draft 2019-09. It has been asked for, but given the age of that issue I don't see it happening any time soon. jsonschema
. I assume that fastjsonschema
was introduced to address some specific performance issue so I don't want to roll that back.jsonschema
usages to use Draft 2019-09. I don't like that because then sometimes we'd be validating with Draft 7 and sometimes with Draft 2019-09. That feels like a bad path to go down.With no sensible option here I'm just putting this issue back in the backlog.
I created this analogous issue for the migration notebooks today (they, too, use Draft7Validator
via jsonschema
).
fastjsonschema
was introduced as a dependency in this commit. I don't know when jsonschema
was introduced as a dependency (it is not listed in the main.in
file—I'll file a separate issue about that).
Here's a recent nmdc-schema
PR that describes a scenario where fastjsonschema
seemed to not tolerate something about our schema: https://github.com/microbiomedata/nmdc-schema/pull/2083
There are a few places where the
nmdc-schema
JSON Schema artifact is provided to aDraft7Validator
(from the jsonschema package). For example. Recently LinkML tooling started generating JSON Schema that is declared to be compatible with JSON Schema Draft 2019-09. We should switch over to using the jsonschema package'svalidator_for
method which inspects the schema and returns the correct validator class.