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 compatible with draft-07 or before. If you use newer version constructs, they will not be supported. If your newer version json schema only uses up to draft-07 features, which most schemas do, then it will probably work fine in the Wizard. 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. On the other hand, 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 and referenced sub-schemas are publicly accessible 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"
). The Semantic Treehouse environment will try to access and in-line all referenced sub-schemas and paste the result in the Local Content field.
After successfully importing the schema, it can be used as input in the Wizard for message model creation.