Closed tobek closed 2 years ago
This will change with YAML, but we expect to still be able to validate an instance against a schema that is identified with a URL.
See https://github.com/w3c-ccg/traceability-vocab/pull/220
After it is merged we expect this to be solved in a different way, but still functional.
+1 agree strongly that this should get addressed, but seems like we want to go revist post pr cutting default over to YAML as noted by @OR13
I think we solved this.
Closing.
The common Ajv library errors when referencing traceability JSON Schemas, since they use a different URI from the Draft 7 meta-schema URI for the
$schema
property (HTTPS"https://json-schema.org/draft-07/schema#"
vs draft's HTTP"http://json-schema.org/draft-07/schema#"
). Ajv doesn't recognize the schema due to the different URI, so it attempts to fetch it, and retrieves and processes the schema, whose ID is the standard HTTP URI, and when it attempts to cache this schema it throwsschema with key or id "http://json-schema.org/draft-07/schema" already exists
, since Ajv bundles the meta-schema automatically.Example code to reproduce the error: https://codepen.io/tobek/pen/zYdyOgO?editors=0011
As of the 2019-09 JSON Schema draft, all meta-schema URIs use HTTPS, but older schemas (such as Draft 7 used by this repo) use HTTP for the canonical URI, so the solution would be either to use that canonical URI, or use a later draft if HTTPS is desired. I'm happy to make the update either way.