Skip to main content

JSON Schema Specifications

Importing JSON Schema Specifications

A Semantic Treehouse JSON Schema Specification can be seen as a wrapper for an existing JSON Schema specification. It is necessary to create such an artifact, before you can use the wizard. Like with other specifications, the specification can be named and described and it can have multiple versions. A specification itself does not hold content, the specification version does hold content. So first a specification, and then a specification version should also be created before content can be added.

The content of a specification can be specified in either of two ways: via a JSON Schema pasted as json text in the Local Content text field. Alternatively, a URL import option is available, that also results in a filled Local Content field.

A. Local Content Copy-and-Paste

When you offer your own JSON Schema in the Local Content: Make sure your JSON schema is correct and the version is draft-07 or before, unfortunately we don't support newer versions yet. The Semantic Treehouse application applies only basic checking to the schema in Semantic Treehouse. Any errors encountered when using the wizard may relate back to errors in the source schema.

References support

Local references to eg. #/definitions/AddressType are supported. Also, remote references (eg. "$ref":"https://example.org/schemas/common-schema#AddressType") are not supported for the Local Content Copy-and-Paste method of entering the schema. If remote references are needed, you can try the URL import way, as long as the schema is publicly available on the web.

B. URL Import and Preprocessing

The URL link offers functionality to load a publicly available schema from the web. It not only downloads the public schema into the Local Content field of the Specification Version, but it also tries to look for and integrate referenced sub-schemas into this Local Content. For example, the Smart Data Models family of schemas offer specific schemas for example for certain devices like a Battery and they have a Common Schema, that is referenced by most of these schemas, because they hold common properties. That common schema is in a different file and it is referenced through $ref links with a resolvable URL ("$ref": "https://github.com/smart-data-models/data-models/blob/master/common-schema.json").