JSON Schema Version

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  User Guide and Reference > JSON, JSON Schema > JSON Schema View >

JSON Schema Version

A JSON schema is written in JSON syntax and will be saved typically in a file with a .json extension. It is indicated as a JSON schema by the $schema keyword, which should be the first keyword of the top-level object and have a value of: "http://json-schema.org/draft-N/schema#" or "http://json-schema.org/schema#".

 

{

   "$schema": "http://json-schema.org/draft-07/schema#",

   ...

}

 

or

 

{

   "$schema": "http://json-schema.org/schema#",

   ...

}

 

In the first example above, the schema version is explicitly named, with version names having the form draft-04, draft-06, etc. If the version name is omitted, as in the second example above, then this indicates that the schema version to be used is the latest version (currently draft-07).

 

In JSON Schema View, you can change the version in the combo box in the bar at the top of the main window (see screenshot below).

JSONSchemaVersion

 

Features of new schema versions that are not defined in an older version

If you use a feature of a newer schema version and then switch to an older version that does not support this feature, then the following happens:

 

A message appears asking whether you wish to remove/convert the feature or keep the feature
If kept, the new feature's corresponding component or detail is shown in an orange text color. For example, if a value has been set for the const keyword (new in draft-06) and you switch the schema version to draft-04, then the value of the const keyword is displayed in orange.

 

JSON Schema versions

For information about the JSON Schema specifications, especially about additional features with each version, see the links below:

 

JSON Schema specification: http://json-schema.org/specification.html

Draft-06 release notes: http://json-schema.org/draft-06/json-schema-release-notes.html

Draft-07 release notes: http://json-schema.org/draft-07/json-schema-release-notes.html

 


© 2019 Altova GmbH