project-open-data / project-open-data.github.io

Open Data Policy — Managing Information as an Asset
https://project-open-data.cio.gov/
Other
1.33k stars 585 forks source link

JSON Schema $ref use issue #655

Open Relequestual opened 2 years ago

Relequestual commented 2 years ago

I raised this same issue at https://github.com/GSA/project-open-data-dashboard/issues/366 but thought it might be worth cross referencing, as you seem to use the same JSON Schemas for validation.

Regarding the catalogue schema...

The JSON Schema uses "draft-04". In draft-04, when $ref is used, all other keywords MUST ("SHALL") be ignored.

https://datatracker.ietf.org/doc/html/draft-pbryan-zyp-json-ref-03#section-3

Any members other than "$ref" in a JSON Reference object SHALL be
ignored.

We (JSON Schema) later bundled the separate JSON Ref specification into the JSON Schema specification.

As of draft 2019-09, $ref can be used alongside other keywords without this adverse effect, however this schema and many others in this repo use draft-04, and so may have instances validate successfully unexpectidly.