Ongoing discussions within the SWIM communities of interest
Ongoing discussions within the SWIM communities of interest
Resources related to the JSON schemas, such as tooling, terminology, examples
Resources
About JSON Schema
Online Validation
Editors (creating content based on the Schema)
- See list of editors: https://json-schema.org/implementations.html
- Tested by SCONE members:
- Applications
- XML Spy (payable)
- VS Code (free)
- Online
- https://rjsf-team.github.io/react-jsonschema-form/ (Easy edit based on form generated from Schema )
- Applications
Terminology
JSON Schema
JSON Schema asserts what a JSON document must look like, ways to extract information from it, and how to interact with it
JSON instance
A JSON document to which a schema is applied is known as an "instance".
JSON Schema validation
asserts constraints on the structure of instance data
Examples
The Donlon TOBT service is provided as an example using schema v0.0.3
- see confluence page: JSON example - Donlon TOBT Setting service description
Validation rules
construct | capability | use |
---|---|---|
"enum": ["Street", "Avenue", "Boulevard"] | for a property, indicates the list of allowed values | used for all code lists |
"additionalProperties": false | for an object indicates that no other properties are allowed than the ones mentioned in the schema | used for every object (since 3c) |
"required": ["prop1", "prop2l"] | for an object indicates the list of properties that are mandatory | used according to rules (since 3d) |
"minItems": 1 | for a property of type array, indicates the minimum number of elements in the array | used for many arrays |
"minLength": 1 | for a property of type string, indicates the minimum length of the string | used for every mandatory string to avoid empty string (since 3e) |
"pattern": "^\d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])$" | for a property of type string, indicates the pattern of its content | used for dates in 3f (could be used for date, url or email addresses eg) |