Skip to content

$schema should point to meta-schema incorporating our changes to JSON Schema #566

@jpmckinney

Description

@jpmckinney

Originally reported via email by @devgateway, quoted below:

The $schema section should define the meta-schema of the current schema. This is used by validation tools that comply with the standard, to correctly identify entities that are part of the schema. Further read on the standard page:

http://json-schema.org/latest/json-schema-core.html#rfc.section.7

and another third party page linked from json-schema.org, they say it is a good read:

https://spacetelescope.github.io/understanding-json-schema/reference/schema.html

The issue is OCDS defines draft-04 as the reference meta-schema: "$schema": "http://json-schema.org/draft-04/schema#"

Because extra properties are defined in the OCDS schema files, the line above should read something like this:

"$schema": "http://standard.open-contracting.org/schema/1__1/meta-schema.json"

which should be an extension of draft-04, adding the deprecated keyword, and others that were added on top of draft-04.

This meta-schema extension should allow:

  • validating the schema itself against the meta-schema (which is self-validating). For example if someone introduces now a typo in the definition of deprecated for a new deprecated field, say deprecatedVersoin instead of deprecatedVersion, this will be spotted easily.

  • make validation tools know what rules to apply for validation, right now they correctly ignore all these extra keywords because $schema says it only has entities defined from draft-04 (which in the case of OCDS release files is false).

So for me, because I use one of these validating libraries in jOCDS, I need to hack the OCDS schema and either remove $schema altogether (which is a problem in itself), or write my own $schema and define your extra keywords there...

Metadata

Metadata

Labels

Focus - ExtensionsRelating to new or proposed extensions, or the governance and maintenance of extensionsFocus - PackagesRelating to release packages and record packagesReady for PRbug

Type

No type

Projects

Status

To do: Refactoring

Relationships

None yet

Development

No branches or pull requests

Issue actions