From c91e60f2a6f4eded8089c19e742750b3ab24a7d2 Mon Sep 17 00:00:00 2001 From: Michael Becker <7737034+elbakerino@users.noreply.github.com> Date: Fri, 18 Sep 2020 21:46:48 +0200 Subject: [PATCH 001/206] Add UI Schema to implementations; Added @ui-schema/ui-schema under ui generation and the corresponding live editor at editors. --- implementations.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/implementations.md b/implementations.md index 7ca2e0ee..a3d85907 100644 --- a/implementations.md +++ b/implementations.md @@ -225,6 +225,7 @@ Various levels of support for UI generation primarily from the validation vocabu - [React JSON Schema Form (mozilla)](https://github.com/mozilla-services/react-jsonschema-form) (Apache 2) - [React Schema Form (networknt)](https://github.com/networknt/react-schema-form) (MIT) - [uniforms (Vazco)](https://github.com/vazco/uniforms) (MIT) + - [UI Schema for React](https://github.com/ui-schema/ui-schema) (MIT) *2019-09 / draft-08, -07, -06, -04 (incompatible `type=integer`)* #### Data from schemas @@ -284,6 +285,7 @@ _None currently support draft-06 or later._ - [JSONEditor Online](https://jsoneditoronline.org/) - *View, edit, format, and validate JSON online* Support draft-4, draft-6, and draft-7. - [Oxygen JSON Editor](https://www.oxygenxml.com/xml_editor/json.html) - *JSON editor with a variety of editing features and helper views. Support for validation and editing JSON Schema draft-4, draft-6, and draft-7. Validation and editing of JSON files based on JSON Schema.* - [Stoplight Studio](https://stoplight.io/) - *JSON Schema IDE (text-based and GUI) with support for JSON/YAML linting, which can also be based on JSON Schema rules via Spectral. Support for draft-4, draft-6 and draft-7.* +- [UI Schema Live Editor](https://ui-schema.bemit.codes/examples/Simple-Demo) *Schema drive live editor with optional ui keywords, creates a form and validates the data with the given schema, supports 2019-09 / draft-08, -07, -06, -04 (incompatible `type=integer`)* - [Visual Studio Code](https://code.visualstudio.com/) - *Schema driven code completion, hovers and validation for editing JSON files (including schemas)* - [WebStorm](https://www.jetbrains.com/webstorm/), [IntelliJ IDEA](https://www.jetbrains.com/idea/), and other [JetBrains IDEs](https://www.jetbrains.com/products.html?fromMenu#type=ide) - *Code completion, documentation, and validation for JSON and YAML files using JSON Schema. Support for draft-4, draft-6, and draft-7.* - [Eclipse IDE](https://www.eclipse.org/downloads/eclipse-packages) - *Rich JSON edition supporting schema for instantaneous validation and error reporting, completion, documentation.* From 0062500a5e3d103288047517052ded8c4832b3a9 Mon Sep 17 00:00:00 2001 From: Michael Becker <7737034+elbakerino@users.noreply.github.com> Date: Fri, 18 Sep 2020 21:49:09 +0200 Subject: [PATCH 002/206] typo fix; --- implementations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implementations.md b/implementations.md index a3d85907..467bbbe5 100644 --- a/implementations.md +++ b/implementations.md @@ -285,7 +285,7 @@ _None currently support draft-06 or later._ - [JSONEditor Online](https://jsoneditoronline.org/) - *View, edit, format, and validate JSON online* Support draft-4, draft-6, and draft-7. - [Oxygen JSON Editor](https://www.oxygenxml.com/xml_editor/json.html) - *JSON editor with a variety of editing features and helper views. Support for validation and editing JSON Schema draft-4, draft-6, and draft-7. Validation and editing of JSON files based on JSON Schema.* - [Stoplight Studio](https://stoplight.io/) - *JSON Schema IDE (text-based and GUI) with support for JSON/YAML linting, which can also be based on JSON Schema rules via Spectral. Support for draft-4, draft-6 and draft-7.* -- [UI Schema Live Editor](https://ui-schema.bemit.codes/examples/Simple-Demo) *Schema drive live editor with optional ui keywords, creates a form and validates the data with the given schema, supports 2019-09 / draft-08, -07, -06, -04 (incompatible `type=integer`)* +- [UI Schema Live Editor](https://ui-schema.bemit.codes/examples/Simple-Demo) *Schema driven live editor with optional ui keywords, creates a form and validates the data with the given schema, supports 2019-09 / draft-08, -07, -06, -04 (incompatible `type=integer`)* - [Visual Studio Code](https://code.visualstudio.com/) - *Schema driven code completion, hovers and validation for editing JSON files (including schemas)* - [WebStorm](https://www.jetbrains.com/webstorm/), [IntelliJ IDEA](https://www.jetbrains.com/idea/), and other [JetBrains IDEs](https://www.jetbrains.com/products.html?fromMenu#type=ide) - *Code completion, documentation, and validation for JSON and YAML files using JSON Schema. Support for draft-4, draft-6, and draft-7.* - [Eclipse IDE](https://www.eclipse.org/downloads/eclipse-packages) - *Rich JSON edition supporting schema for instantaneous validation and error reporting, completion, documentation.* From 6f3d8adc8bf3d826eb8081395c697c8eb7cf0e50 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Fri, 18 Sep 2020 21:15:52 +0100 Subject: [PATCH 003/206] Remove UI Schema Live Editor from the list of editors I do not feel this is a JSON Schema editor. --- implementations.md | 1 - 1 file changed, 1 deletion(-) diff --git a/implementations.md b/implementations.md index 467bbbe5..b3f81a74 100644 --- a/implementations.md +++ b/implementations.md @@ -285,7 +285,6 @@ _None currently support draft-06 or later._ - [JSONEditor Online](https://jsoneditoronline.org/) - *View, edit, format, and validate JSON online* Support draft-4, draft-6, and draft-7. - [Oxygen JSON Editor](https://www.oxygenxml.com/xml_editor/json.html) - *JSON editor with a variety of editing features and helper views. Support for validation and editing JSON Schema draft-4, draft-6, and draft-7. Validation and editing of JSON files based on JSON Schema.* - [Stoplight Studio](https://stoplight.io/) - *JSON Schema IDE (text-based and GUI) with support for JSON/YAML linting, which can also be based on JSON Schema rules via Spectral. Support for draft-4, draft-6 and draft-7.* -- [UI Schema Live Editor](https://ui-schema.bemit.codes/examples/Simple-Demo) *Schema driven live editor with optional ui keywords, creates a form and validates the data with the given schema, supports 2019-09 / draft-08, -07, -06, -04 (incompatible `type=integer`)* - [Visual Studio Code](https://code.visualstudio.com/) - *Schema driven code completion, hovers and validation for editing JSON files (including schemas)* - [WebStorm](https://www.jetbrains.com/webstorm/), [IntelliJ IDEA](https://www.jetbrains.com/idea/), and other [JetBrains IDEs](https://www.jetbrains.com/products.html?fromMenu#type=ide) - *Code completion, documentation, and validation for JSON and YAML files using JSON Schema. Support for draft-4, draft-6, and draft-7.* - [Eclipse IDE](https://www.eclipse.org/downloads/eclipse-packages) - *Rich JSON edition supporting schema for instantaneous validation and error reporting, completion, documentation.* From d2595bac7ebf240c88291b4081fe15decbbe781e Mon Sep 17 00:00:00 2001 From: Jim Blackler Date: Fri, 23 Oct 2020 19:44:20 +0100 Subject: [PATCH 004/206] Update validator-libraries-modern.yml --- _data/validator-libraries-modern.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 45f2c77f..bdd8c10d 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -119,6 +119,12 @@ date-draft: draft: [7, 6, 4] license: Apache License 2.0 + - name: jsonschemafriend + url: https://github.com/jimblackler/jsonschematypes/tree/master/library + notes: + date-draft: [2019-09] + draft: [7, 6, 4, 3] + license: Apache License 2.0 - name: Kotlin implementations: - name: Medeia-validator From 42d3c8000bf54981922f1779e596e8c5f196b5e6 Mon Sep 17 00:00:00 2001 From: Jim Blackler Date: Fri, 23 Oct 2020 19:57:21 +0100 Subject: [PATCH 005/206] Add my projects to code and data generators. --- implementations.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/implementations.md b/implementations.md index 971abd59..381b3fd1 100644 --- a/implementations.md +++ b/implementations.md @@ -196,6 +196,7 @@ are the only keywords that changed. - [json-schema-to-elm](https://github.com/dragonwasrobot/json-schema-to-elm) - generates Elm types, JSON decoders+encoders, and fuzz tests from one or more JSON Schema files, using [dragonwasrobot/json_schema](https://github.com/dragonwasrobot/json_schema) *supports Draft 7* - Java - [jsonCodeGen](https://github.com/schlothauer-wauer/jsoncodegen) (MIT) - Groovy based generation tasks from JSON schema. Already includes templates/generators for Java Beans, Swagger specification files and PlantUML diagrams. + - [jsongenerator](https://github.com/jimblackler/jsonschematypes/tree/master/codegen) *JSON Schema 2019-09, draft-07, -06, -04, -03* (Apache-2.0) - Online (web tool) - [quicktype.io](https://app.quicktype.io/#l=schema) - infer JSON Schema from samples, and generate TypeScript, C++, go, Java, C#, Swift, etc. types from JSON Schema - PHP @@ -205,6 +206,8 @@ are the only keywords that changed. - [statham](https://github.com/jacksmith15/statham-schema) (MIT) - generate type-annotated models from JSON Schema documents. - Rust - [schemafy](https://github.com/Marwes/schemafy/) - generates Rust types and serialization code from a JSON schema. *supports Draft 4* +- TypeScript + - [jsongenerator](https://github.com/jimblackler/jsonschematypes/tree/master/codegen) *JSON Schema 2019-09, draft-07, -06, -04, -03* (Apache-2.0) #### Web UI generation @@ -231,6 +234,8 @@ Various levels of support for UI generation primarily from the validation vocabu - Python - [hypothesis-jsonschema](https://github.com/Zac-HD/hypothesis-jsonschema) (MPL) *draft-07, -06, -04*; takes any schema, even with complex and interacting constraints, and returns a [Hypothesis](https://hypothesis.works/) strategy which can generate valid documents for testing. +- Java + - [jsongenerator](https://github.com/jimblackler/jsongenerator) *JSON Schema 2019-09, draft-07, -06, -04, -03* (Apache-2.0) Utilities --------- From e47a74f2e821cd7cfe34058ad32e1034d0e59718 Mon Sep 17 00:00:00 2001 From: Jim Blackler Date: Sat, 24 Oct 2020 13:55:13 +0100 Subject: [PATCH 006/206] Update validator-libraries-modern.yml --- _data/validator-libraries-modern.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index bdd8c10d..1962e75e 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -120,7 +120,7 @@ draft: [7, 6, 4] license: Apache License 2.0 - name: jsonschemafriend - url: https://github.com/jimblackler/jsonschematypes/tree/master/library + url: https://github.com/jimblackler/jsonschemafriend notes: date-draft: [2019-09] draft: [7, 6, 4, 3] From dafc80f8a487469b5636959a6803914c80b42e82 Mon Sep 17 00:00:00 2001 From: Peter Wall Date: Sun, 25 Oct 2020 21:06:28 +1100 Subject: [PATCH 007/206] Please consider adding json-kotlin-schema and -codegen to the implementation list --- _data/validator-libraries-modern.yml | 6 ++++++ implementations.md | 2 ++ 2 files changed, 8 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 45f2c77f..6c37bd84 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -127,6 +127,12 @@ date-draft: draft: [7, 6, 4] license: Apache License 2.0 + - name: json-kotlin-schema + url: https://github.com/pwall567/json-kotlin-schema + notes: Kotlin implementation of JSON Schema + date-draft: [2019-09] + draft: [7] + license: MIT - name: JavaScript implementations: - name: ajv diff --git a/implementations.md b/implementations.md index 971abd59..9e44db92 100644 --- a/implementations.md +++ b/implementations.md @@ -196,6 +196,8 @@ are the only keywords that changed. - [json-schema-to-elm](https://github.com/dragonwasrobot/json-schema-to-elm) - generates Elm types, JSON decoders+encoders, and fuzz tests from one or more JSON Schema files, using [dragonwasrobot/json_schema](https://github.com/dragonwasrobot/json_schema) *supports Draft 7* - Java - [jsonCodeGen](https://github.com/schlothauer-wauer/jsoncodegen) (MIT) - Groovy based generation tasks from JSON schema. Already includes templates/generators for Java Beans, Swagger specification files and PlantUML diagrams. +- Kotlin + - [json-kotlin-schema-codegen](https://github.com/pwall567/json-kotlin-schema-codegen) (MIT) - Generates Kotlin data classes from JSON Schema. - Online (web tool) - [quicktype.io](https://app.quicktype.io/#l=schema) - infer JSON Schema from samples, and generate TypeScript, C++, go, Java, C#, Swift, etc. types from JSON Schema - PHP From 3ae1b0794ac1208e9519f3a2fbab47713a2d0279 Mon Sep 17 00:00:00 2001 From: restspace <75081878+restspace@users.noreply.github.com> Date: Wed, 16 Dec 2020 22:51:31 +0000 Subject: [PATCH 008/206] Add restspace/schema-form to Implementations/Web UI generation --- implementations.md | 1 + 1 file changed, 1 insertion(+) diff --git a/implementations.md b/implementations.md index 971abd59..51c7fd27 100644 --- a/implementations.md +++ b/implementations.md @@ -225,6 +225,7 @@ Various levels of support for UI generation primarily from the validation vocabu - [Liform-react](https://github.com/Limenius/liform-react) (MIT) - [React JSON Schema Form (mozilla)](https://github.com/mozilla-services/react-jsonschema-form) (Apache 2) - [React Schema Form (networknt)](https://github.com/networknt/react-schema-form) (MIT) + - [Restspace Schema Form](https://github.com/restspace/schema-form) (MIT) - [uniforms (Vazco)](https://github.com/vazco/uniforms) (MIT) #### Data from schemas From 140c7e89981c8f83d97de5736e1933b9f3173706 Mon Sep 17 00:00:00 2001 From: danielaparker Date: Mon, 18 Jan 2021 22:13:32 -0500 Subject: [PATCH 009/206] jsoncons supports JSON Schema Draft 7 --- _data/validator-libraries-modern.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 8c6d86fc..dc9f9022 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -42,6 +42,12 @@ date-draft: draft: [7] license: BSD-2-Clause + - name: jsoncons + url: https://github.com/danielaparker/jsoncons/blob/master/doc/ref/jsonschema/jsonschema.md + notes: Header-only library + date-draft: + draft: [7] + license: Boost Software License 1.0 - name: Clojure implementations: - name: jinx From 6d93e2be8b5f96a692d6d93a290f1f55e70e15ea Mon Sep 17 00:00:00 2001 From: Vipin Tanna <6302771+vip-git@users.noreply.github.com> Date: Mon, 25 Jan 2021 03:17:54 +0100 Subject: [PATCH 010/206] Update implementations.md --- implementations.md | 1 + 1 file changed, 1 insertion(+) diff --git a/implementations.md b/implementations.md index 971abd59..8d9714cf 100644 --- a/implementations.md +++ b/implementations.md @@ -224,6 +224,7 @@ Various levels of support for UI generation primarily from the validation vocabu - [JSONForms (jsonforms.io)](https://jsonforms.io/) (EclipseSource) (MIT) - [Liform-react](https://github.com/Limenius/liform-react) (MIT) - [React JSON Schema Form (mozilla)](https://github.com/mozilla-services/react-jsonschema-form) (Apache 2) + - [React Json Schema Form (Mui)](https://github.com/vip-git/react-jsonschema-form-material-ui) (MIT) - [React Schema Form (networknt)](https://github.com/networknt/react-schema-form) (MIT) - [uniforms (Vazco)](https://github.com/vazco/uniforms) (MIT) From ec240024fe360208f0224df3d37095b1029abee3 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Thu, 18 Feb 2021 10:11:22 -0800 Subject: [PATCH 011/206] Update all schemas in /learn to 2020-12 --- learn/examples/address.schema.json | 4 +- learn/examples/calendar.schema.json | 4 +- learn/examples/card.schema.json | 6 +- .../geographical-location.schema.json | 2 +- learn/file-system.md | 58 +++++++++---------- learn/getting-started-step-by-step.md | 30 +++++----- learn/miscellaneous-examples.md | 12 ++-- 7 files changed, 58 insertions(+), 58 deletions(-) diff --git a/learn/examples/address.schema.json b/learn/examples/address.schema.json index 77fadaf2..7b62083a 100644 --- a/learn/examples/address.schema.json +++ b/learn/examples/address.schema.json @@ -1,6 +1,6 @@ { "$id": "https://example.com/address.schema.json", - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2020-12/schema", "description": "An address similar to http://microformats.org/wiki/h-card", "type": "object", "properties": { @@ -27,7 +27,7 @@ } }, "required": [ "locality", "region", "country-name" ], - "dependencies": { + "dependentRequired": { "post-office-box": [ "street-address" ], "extended-address": [ "street-address" ] } diff --git a/learn/examples/calendar.schema.json b/learn/examples/calendar.schema.json index 7e235efc..afc40c51 100644 --- a/learn/examples/calendar.schema.json +++ b/learn/examples/calendar.schema.json @@ -1,6 +1,6 @@ { "$id": "https://example.com/calendar.schema.json", - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2020-12/schema", "description": "A representation of an event", "type": "object", "required": [ "dtstart", "summary" ], @@ -41,7 +41,7 @@ "type": "string" }, "geo": { - "$ref": "http://example.com/geographical-location.schema.json" + "$ref": "https://example.com/geographical-location.schema.json" } } } diff --git a/learn/examples/card.schema.json b/learn/examples/card.schema.json index a19439a6..acb33e2a 100644 --- a/learn/examples/card.schema.json +++ b/learn/examples/card.schema.json @@ -1,6 +1,6 @@ { "$id": "https://example.com/card.schema.json", - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2020-12/schema", "description": "A representation of a person, company, organization, or place", "type": "object", "required": [ "familyName", "givenName" ], @@ -61,8 +61,8 @@ } } }, - "adr": { "$ref": "http://example.com/address.schema.json" }, - "geo": { "$ref": "http://example.com/geographical-location.schema.json" }, + "adr": { "$ref": "https://example.com/address.schema.json" }, + "geo": { "$ref": "https://example.com/geographical-location.schema.json" }, "tz": { "type": "string" }, diff --git a/learn/examples/geographical-location.schema.json b/learn/examples/geographical-location.schema.json index 1e0fc9cf..758dca8f 100644 --- a/learn/examples/geographical-location.schema.json +++ b/learn/examples/geographical-location.schema.json @@ -1,6 +1,6 @@ { "$id": "https://example.com/geographical-location.schema.json", - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Longitude and Latitude Values", "description": "A geographical coordinate.", "required": [ "latitude", "longitude" ], diff --git a/learn/file-system.md b/learn/file-system.md index 65048d03..e7103b2b 100644 --- a/learn/file-system.md +++ b/learn/file-system.md @@ -82,8 +82,8 @@ Building out our JSON Schema from top to bottom: ```json { - "$id": "http://example.com/fstab", - "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://example.com/fstab", + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "required": [ "/" ], "properties": { @@ -108,13 +108,13 @@ To this we add: * The [`oneOf`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.7.3) keyword. * The [`$ref`](http://json-schema.org/latest/json-schema-core.html#rfc.section.8.3) keyword. * In this case, all references used are local to the schema using a relative fragment URI (`#/...`). -* The [`definitions`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.9) keyword. +* The [`$defs`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.9) keyword. * Including several key names which we will define later. ```json { - "$id": "http://example.com/entry-schema", - "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://example.com/entry-schema", + "$schema": "https://json-schema.org/draft/2020-12/schema", "description": "JSON Schema for an fstab entry", "type": "object", "required": [ "storage" ], @@ -122,14 +122,14 @@ To this we add: "storage": { "type": "object", "oneOf": [ - { "$ref": "#/definitions/diskDevice" }, - { "$ref": "#/definitions/diskUUID" }, - { "$ref": "#/definitions/nfs" }, - { "$ref": "#/definitions/tmpfs" } + { "$ref": "#/$defs/diskDevice" }, + { "$ref": "#/$defs/diskUUID" }, + { "$ref": "#/$defs/nfs" }, + { "$ref": "#/$defs/tmpfs" } ] } }, - "definitions": { + "$defs": { "diskDevice": {}, "diskUUID": {}, "nfs": {}, @@ -155,8 +155,8 @@ With these added constraints, the schema now looks like this: ```json { - "$id": "http://example.com/entry-schema", - "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://example.com/entry-schema", + "$schema": "https://json-schema.org/draft/2020-12/schema", "description": "JSON Schema for an fstab entry", "type": "object", "required": [ "storage" ], @@ -164,10 +164,10 @@ With these added constraints, the schema now looks like this: "storage": { "type": "object", "oneOf": [ - { "$ref": "#/definitions/diskDevice" }, - { "$ref": "#/definitions/diskUUID" }, - { "$ref": "#/definitions/nfs" }, - { "$ref": "#/definitions/tmpfs" } + { "$ref": "#/$defs/diskDevice" }, + { "$ref": "#/$defs/diskUUID" }, + { "$ref": "#/$defs/nfs" }, + { "$ref": "#/$defs/tmpfs" } ] }, "fstype": { @@ -185,7 +185,7 @@ With these added constraints, the schema now looks like this: "type": "boolean" } }, - "definitions": { + "$defs": { "diskDevice": {}, "diskUUID": {}, "nfs": {}, @@ -303,8 +303,8 @@ The resulting schema is quite large: ```json { - "$id": "http://example.com/entry-schema", - "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://example.com/entry-schema", + "$schema": "https://json-schema.org/draft/2020-12/schema", "description": "JSON Schema for an fstab entry", "type": "object", "required": [ "storage" ], @@ -312,10 +312,10 @@ The resulting schema is quite large: "storage": { "type": "object", "oneOf": [ - { "$ref": "#/definitions/diskDevice" }, - { "$ref": "#/definitions/diskUUID" }, - { "$ref": "#/definitions/nfs" }, - { "$ref": "#/definitions/tmpfs" } + { "$ref": "#/$defs/diskDevice" }, + { "$ref": "#/$defs/diskUUID" }, + { "$ref": "#/$defs/nfs" }, + { "$ref": "#/$defs/tmpfs" } ] }, "fstype": { @@ -333,7 +333,7 @@ The resulting schema is quite large: "type": "boolean" } }, - "definitions": { + "$defs": { "diskDevice": { "properties": { "type": { @@ -404,16 +404,16 @@ Coming full circle we use the `$ref` keyword to add our entry schema into the ke ```json { - "$id": "http://example.com/fstab", - "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://example.com/fstab", + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "required": [ "/" ], "properties": { - "/": { "$ref": "http://example.com/entry-schema" } + "/": { "$ref": "https://example.com/entry-schema" } }, "patternProperties": { - "^(/[^/]+)+$": { "$ref": "http://example.com/entry-schema" } + "^(/[^/]+)+$": { "$ref": "https://example.com/entry-schema" } }, - "additionalProperties": false, + "additionalProperties": false } ``` diff --git a/learn/getting-started-step-by-step.md b/learn/getting-started-step-by-step.md index 94b3a27a..aeebca0d 100644 --- a/learn/getting-started-step-by-step.md +++ b/learn/getting-started-step-by-step.md @@ -57,8 +57,8 @@ We start with four properties called **keywords** which are expressed as [JSON]( ```json { - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://example.com/product.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://example.com/product.schema.json", "title": "Product", "description": "A product in the catalog", "type": "object" @@ -85,8 +85,8 @@ In JSON Schema terms, we update our schema to add: ```json { - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://example.com/product.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://example.com/product.schema.json", "title": "Product", "description": "A product from Acme's catalog", "type": "object", @@ -106,8 +106,8 @@ In JSON Schema terms, we update our schema to add: ```json { - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://example.com/product.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://example.com/product.schema.json", "title": "Product", "description": "A product from Acme's catalog", "type": "object", @@ -135,8 +135,8 @@ According to the store owner there are no free products. ;) ```json { - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://example.com/product.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://example.com/product.schema.json", "title": "Product", "description": "A product from Acme's catalog", "type": "object", @@ -179,8 +179,8 @@ Therefore: ```json { - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://example.com/product.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://example.com/product.schema.json", "title": "Product", "description": "A product from Acme's catalog", "type": "object", @@ -222,8 +222,8 @@ Up until this point we've been dealing with a very flat schema -- only one level ```json { - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://example.com/product.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://example.com/product.schema.json", "title": "Product", "description": "A product from Acme's catalog", "type": "object", @@ -282,7 +282,7 @@ For this example we introduce a new JSON Schema resource and for both properties ```json { "$id": "https://example.com/geographical-location.schema.json", - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Longitude and Latitude", "description": "A geographical coordinate on a planet (most commonly Earth).", "required": [ "latitude", "longitude" ], @@ -306,8 +306,8 @@ Next we add a reference to this new schema so it can be incorporated. ```json { - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://example.com/product.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://example.com/product.schema.json", "title": "Product", "description": "A product from Acme's catalog", "type": "object", diff --git a/learn/miscellaneous-examples.md b/learn/miscellaneous-examples.md index 29bb7747..f73ef943 100644 --- a/learn/miscellaneous-examples.md +++ b/learn/miscellaneous-examples.md @@ -20,7 +20,7 @@ This example provides a typical minimum you are likely to see in JSON Schema. It ```json { "$id": "https://example.com/person.schema.json", - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Person", "type": "object", "properties": { @@ -62,7 +62,7 @@ This example introduces: ```json { "$id": "https://example.com/geographical-location.schema.json", - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Longitude and Latitude Values", "description": "A geographical coordinate.", "required": [ "latitude", "longitude" ], @@ -100,13 +100,13 @@ Arrays are fundamental structures in JSON -- here we demonstrate a couple of way We also introduce the following with this example: -* [`definitions`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.9) keyword +* [`$defs`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.9) keyword * [`$ref`](http://json-schema.org/latest/json-schema-core.html#rfc.section.8.3) keyword ```json { "$id": "https://example.com/arrays.schema.json", - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2020-12/schema", "description": "A representation of a person, company, organization, or place", "type": "object", "properties": { @@ -118,10 +118,10 @@ We also introduce the following with this example: }, "vegetables": { "type": "array", - "items": { "$ref": "#/definitions/veggie" } + "items": { "$ref": "#/$defs/veggie" } } }, - "definitions": { + "$defs": { "veggie": { "type": "object", "required": [ "veggieName", "veggieLike" ], From 5bcac3450df2763fa1d440a854d0895cd4a9fbe6 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Wed, 17 Feb 2021 12:08:14 -0800 Subject: [PATCH 012/206] Fix propertyNames example in draft-06 release notes --- draft-06/json-schema-release-notes.md | 34 +++++++++++++-------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/draft-06/json-schema-release-notes.md b/draft-06/json-schema-release-notes.md index 68984b5c..6716725b 100644 --- a/draft-06/json-schema-release-notes.md +++ b/draft-06/json-schema-release-notes.md @@ -70,19 +70,19 @@ The difficulty is that if you attempt to do this: { "type": "object", "allOf": [ - {"$ref": "#/definitions/foo"}, - {"$ref": "#/definitions/bar"} + { "$ref": "#/definitions/foo" }, + { "$ref": "#/definitions/bar" } ], "definitions": { "foo": { "properties": { - "foo": {"type": "string"} + "foo": { "type": "string" } }, "additionalProperties": false }, "bar": { "properties": { - "bar": {"type": "number"} + "bar": { "type": "number" } }, "additionalProperties": false } @@ -100,30 +100,28 @@ A workaround is available with the new `"propertyNames"` keyword: { "type": "object", "allOf": [ - {"$ref": "#/definitions/foo"}, - {"$ref": "#/definitions/bar"} - ], - "anyOf": [ - {"$ref": "#/definitions/fooNames"}, - {"$ref": "#/definitions/barNames"} + { "$ref": "#/definitions/foo" }, + { "$ref": "#/definitions/bar" } ], + "propertyNames": { + "anyOf": [ + { "$ref": "#/definitions/fooNames" }, + { "$ref": "#/definitions/barNames" } + ] + }, "definitions": { "foo": { "properties": { - "foo": {"type": "string"} + "foo": { "type": "string" } } }, - "fooNames": { - "propertyNames": {"enum": ["foo"]} - }, + "fooNames": { "enum": ["foo"] }, "bar": { "properties": { - "bar": {"type": "number"} + "bar": { "type": "number" } } }, - "barNames": { - "propertyNames": {"enum": ["bar"]} - } + "barNames": { "enum": ["bar"] } } } ``` From b298dc2aa4dd7da0013c694d14d04f07188edd91 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Tue, 8 Dec 2020 21:03:47 -0800 Subject: [PATCH 013/206] Update Hyperjump JSV for draft 2020-12 --- _data/validator-libraries-modern.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index c81c1e6d..34e9db7f 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -146,7 +146,7 @@ - name: Hyperjump JSV url: https://github.com/jdesrosiers/json-schema notes: "Built for Node.js and browsers. Includes support for custom vocabularies." - date-draft: [2019-09] + date-draft: [2019-09, 2020-12] draft: [7, 6, 4] license: MIT - name: vue-vuelidate-jsonschema @@ -243,7 +243,7 @@ implementations: - name: Hyperjump JSV url: https://json-schema.hyperjump.io - date-draft: [2019-09] + date-draft: [2019-09, 2020-12] draft: [7, 6, 4] notes: Supports multiple schemas and multiple instances - name: JSON Schema Validator From ef52582bca74be1030b2af3d1a663ecb53e165ac Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Thu, 18 Feb 2021 11:58:43 -0800 Subject: [PATCH 014/206] Update spec links in /learn to 2020-12 --- learn/file-system.md | 38 +++++++++++++-------------- learn/getting-started-step-by-step.md | 30 ++++++++++----------- learn/miscellaneous-examples.md | 24 ++++++++--------- 3 files changed, 46 insertions(+), 46 deletions(-) diff --git a/learn/file-system.md b/learn/file-system.md index e7103b2b..72e32e3a 100644 --- a/learn/file-system.md +++ b/learn/file-system.md @@ -66,16 +66,16 @@ We will start with a base JSON Schema expressing the following constraints: Building out our JSON Schema from top to bottom: -* The [`$id`](http://json-schema.org/latest/json-schema-core.html#rfc.section.8.2) keyword. -* The [`$schema`](http://json-schema.org/latest/json-schema-core.html#rfc.section.7) keyword. -* The [`type`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1) validation keyword. -* The [`required`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.3) validation keyword. -* The [`properties`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.4) validation keyword. +* The [`$id`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.1) keyword. +* The [`$schema`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.1) keyword. +* The [`type`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.1) validation keyword. +* The [`required`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.5.3) validation keyword. +* The [`properties`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.1) validation keyword. * The `/` key is empty now; We will fill it out later. -* The [`patternProperties`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.5) validation keyword. +* The [`patternProperties`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.2) validation keyword. * This matches other property names via a regular expression. Note: it does not match `/`. * The `^(/[^/]+)+$` key is empty now; We will fill it out later. -* The [`additionalProperties`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.6) validation keyword. +* The [`additionalProperties`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.3) validation keyword. * The value here is `false` to constrain object properties to be either `/` or to match the regular expression. > You will notice that the regular expression is explicitly anchored (with `^` and `$`): in JSON Schema, regular expressions (in `patternProperties` and in `pattern`) are not anchored by default. @@ -104,11 +104,11 @@ We saw these keywords in the prior exercise: `$id`, `$schema`, `type`, `required To this we add: -* The [`description`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.10.1) annotation keyword. -* The [`oneOf`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.7.3) keyword. -* The [`$ref`](http://json-schema.org/latest/json-schema-core.html#rfc.section.8.3) keyword. +* The [`description`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) annotation keyword. +* The [`oneOf`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.2.1.3) keyword. +* The [`$ref`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.3.1) keyword. * In this case, all references used are local to the schema using a relative fragment URI (`#/...`). -* The [`$defs`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.9) keyword. +* The [`$defs`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.4) keyword. * Including several key names which we will define later. ```json @@ -142,12 +142,12 @@ To this we add: Let's now extend this skeleton to add constraints to some of the properties. -* Our `fstype` key uses the [`enum`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.2) validation keyword. +* Our `fstype` key uses the [`enum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.2) validation keyword. * Our `options` key uses the following: * The `type` validation keyword (see above). - * The [`minItems`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.4) validation keyword. - * The [`items`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.1) validation keyword. - * The [`uniqueItems`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.5) validation keyword. + * The [`minItems`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.2) validation keyword. + * The [`items`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.1.2) validation keyword. + * The [`uniqueItems`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.3) validation keyword. * Together these say: `options` must be an array, and the items therein must be strings, there must be at least one item, and all items should be unique. * We have a `readonly` key. @@ -198,7 +198,7 @@ With these added constraints, the schema now looks like this: One new keyword is introduced here: -* The [`pattern`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.3) validation keyword notes the `device` key must be an absolute path starting with */dev*. +* The [`pattern`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.3.3) validation keyword notes the `device` key must be an absolute path starting with */dev*. ```json { @@ -246,7 +246,7 @@ We do have a new key: `label` and the `pattern` validation keyword states it mus We find another new keyword: -* The [`format`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.7) annotation and assertion keyword. +* The [`format`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.7) annotation and assertion keyword. ```json { @@ -276,8 +276,8 @@ We find another new keyword: Our last definition introduces two new keywords: -* The [`minimum`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.4) validation keyword. -* The [`maximum`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.2) validation keword. +* The [`minimum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.4) validation keyword. +* The [`maximum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.2) validation keword. * Together these require the size be between 16 and 512, inclusive. ```json diff --git a/learn/getting-started-step-by-step.md b/learn/getting-started-step-by-step.md index aeebca0d..4a1eae90 100644 --- a/learn/getting-started-step-by-step.md +++ b/learn/getting-started-step-by-step.md @@ -50,10 +50,10 @@ We start with four properties called **keywords** which are expressed as [JSON]( > Yes. the standard uses a JSON data document to describe data documents, most often that are also JSON data documents but could be in any number of other content types like `text/xml`. -* The [`$schema`](http://json-schema.org/latest/json-schema-core.html#rfc.section.7) keyword states that this schema is written according to a specific draft of the standard and used for a variety of reasons, primarily version control. -* The [`$id`](http://json-schema.org/latest/json-schema-core.html#rfc.section.8.2) keyword defines a URI for the schema, and the base URI that other URI references within the schema are resolved against. -* The [`title`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.10.1) and [`description`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.10.1) annotation keywords are descriptive only. They do not add constraints to the data being validated. The intent of the schema is stated with these two keywords. -* The [`type`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1) validation keyword defines the first constraint on our JSON data and in this case it has to be a JSON Object. +* The [`$schema`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.1) keyword states that this schema is written according to a specific draft of the standard and used for a variety of reasons, primarily version control. +* The [`$id`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.1) keyword defines a URI for the schema, and the base URI that other URI references within the schema are resolved against. +* The [`title`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) and [`description`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) annotation keywords are descriptive only. They do not add constraints to the data being validated. The intent of the schema is stated with these two keywords. +* The [`type`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.1) validation keyword defines the first constraint on our JSON data and in this case it has to be a JSON Object. ```json { @@ -67,9 +67,9 @@ We start with four properties called **keywords** which are expressed as [JSON]( We introduce the following pieces of terminology when we start the schema: -* [Schema Keyword](http://json-schema.org/latest/json-schema-core.html#rfc.section.4.3.1): `$schema` and `$id`. -* [Schema Annotations](http://json-schema.org/latest/json-schema-validation.html#rfc.section.10): `title` and `description`. -* [Validation Keyword](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6): `type`. +* [Schema Keyword](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.1): `$schema` and `$id`. +* [Schema Annotations](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1): `title` and `description`. +* [Validation Keyword](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.1): `type`. ## Defining the properties @@ -77,10 +77,10 @@ We introduce the following pieces of terminology when we start the schema: In JSON Schema terms, we update our schema to add: -* The [`properties`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.4) validation keyword. +* The [`properties`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.1) validation keyword. * The `productId` key. * `description` schema annotation and `type` validation keyword is noted -- we covered both of these in the previous section. -* The [`required`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.3) validation keyword listing `productId`. +* The [`required`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.5.3) validation keyword listing `productId`. ```json @@ -130,8 +130,8 @@ In JSON Schema terms, we update our schema to add: According to the store owner there are no free products. ;) * The `price` key is added with the usual `description` schema annotation and `type` validation keywords covered previously. It is also included in the array of keys defined by the `required` validation keyword. -* We specify the value of `price` must be something other than zero using the [`exclusiveMinimum`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.5) validation keyword. - * If we wanted to include zero as a valid price we would have specified the [`minimum`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.4) validation keyword. +* We specify the value of `price` must be something other than zero using the [`exclusiveMinimum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.5) validation keyword. + * If we wanted to include zero as a valid price we would have specified the [`minimum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.4) validation keyword. ```json { @@ -172,9 +172,9 @@ Therefore: * The `tags` key is added with the usual annotations and keywords. * This time the `type` validation keyword is `array`. -* We introduce the [`items`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.1) validation keyword so we can define what appears in the array. In this case: `string` values via the `type` validation keyword. -* The [`minItems`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.4) validation keyword is used to make sure there is at least one item in the array. -* The [`uniqueItems`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.5) validation keyword notes all of the items in the array must be unique relative to one another. +* We introduce the [`items`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.1.2) validation keyword so we can define what appears in the array. In this case: `string` values via the `type` validation keyword. +* The [`minItems`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.2) validation keyword is used to make sure there is at least one item in the array. +* The [`uniqueItems`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.3) validation keyword notes all of the items in the array must be unique relative to one another. * We did not add this key to the `required` validation keyword array because it is optional. ```json @@ -276,7 +276,7 @@ So far our JSON schema has been wholly self contained. It is very common to shar For this example we introduce a new JSON Schema resource and for both properties therein: * We use the `minimum` validation keyword noted earlier. -* We add the [`maximum`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.2) validation keyword. +* We add the [`maximum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.2) validation keyword. * Combined, these give us a range to use in validation. ```json diff --git a/learn/miscellaneous-examples.md b/learn/miscellaneous-examples.md index f73ef943..754e6f4a 100644 --- a/learn/miscellaneous-examples.md +++ b/learn/miscellaneous-examples.md @@ -7,15 +7,15 @@ title: Miscellaneous Examples This example provides a typical minimum you are likely to see in JSON Schema. It contains: -* [`$id`](http://json-schema.org/latest/json-schema-core.html#rfc.section.8.2) keyword -* [`$schema`](http://json-schema.org/latest/json-schema-core.html#rfc.section.7) keyword -* [`title`](http://json-schema.org/latest/json-schema-hypermedia.html#rfc.section.6.5.1) annotation keyword -* [`type`](http://json-schema.org/latest/json-schema-core.html#rfc.section.4.2.1) instance data model -* [`properties`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.4) validation keyword +* [`$id`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.1) keyword +* [`$schema`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.1) keyword +* [`title`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) annotation keyword +* [`type`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.1) instance data model +* [`properties`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.1) validation keyword * Three keys: `firstName`, `lastName` and `age` each with their own: - * [`description`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.10.1) annotation keyword. + * [`description`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) annotation keyword. * `type` instance data model (see above). -* [`minimum`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.4) validation keyword on the `age` key. +* [`minimum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.4) validation keyword on the `age` key. ```json { @@ -55,9 +55,9 @@ This example provides a typical minimum you are likely to see in JSON Schema. It This example introduces: -* [`required`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.3) validation keyword -* [`minimum`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.4) validation keyword -* [`maximum`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.2) validation keyword +* [`required`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.5.3) validation keyword +* [`minimum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.4) validation keyword +* [`maximum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.2) validation keyword ```json { @@ -100,8 +100,8 @@ Arrays are fundamental structures in JSON -- here we demonstrate a couple of way We also introduce the following with this example: -* [`$defs`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.9) keyword -* [`$ref`](http://json-schema.org/latest/json-schema-core.html#rfc.section.8.3) keyword +* [`$defs`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.4) keyword +* [`$ref`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.3.1) keyword ```json { From 1622768dd4b009fadf77771903ab85d3a876c77b Mon Sep 17 00:00:00 2001 From: GitHubPang <61439577+GitHubPang@users.noreply.github.com> Date: Wed, 24 Feb 2021 08:07:29 +0800 Subject: [PATCH 015/206] Fix typos in index.md --- index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.md b/index.md index 4adc7d49..b4a512cc 100644 --- a/index.md +++ b/index.md @@ -50,12 +50,12 @@ See the [Specification page](specification.html) for details about naming and nu ### The Path to Standardization -The JSON Schema project intends to shepherd all three draft series to either: RFC status, the equivilent within another standards body, and/or join a foundation and establish self publication rules. +The JSON Schema project intends to shepherd all three draft series to either: RFC status, the equivalent within another standards body, and/or join a foundation and establish self publication rules.
Read more -Currently, we are continuing to improve our self-published Internet-Drafts. We are not activly pursuing joining a standards organisation. +Currently, we are continuing to improve our self-published Internet-Drafts. We are not actively pursuing joining a standards organisation. We have a few contacts related to each potential path, but if you have experience with such things and would like to help, please still contact us! From d7e4cf1ed9cb49689a570101069b08755aaf28da Mon Sep 17 00:00:00 2001 From: GitHubPang <61439577+GitHubPang@users.noreply.github.com> Date: Wed, 24 Feb 2021 08:08:53 +0800 Subject: [PATCH 016/206] Fix invalid link in CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6f0efcc2..77556cc1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,3 @@ Thank you for your interest in contributing to JSON Schema! Your participation is appreciated! -If your question/request/change concerns the [JSON Schema Website](json-schema.org) you are in the right place. If your question/request/change concerns the JSON Schema specification drafts or meta-schemas, please go to [the JSON Schema specification repository](https://github.com/json-schema-org/json-schema-spec). \ No newline at end of file +If your question/request/change concerns the [JSON Schema Website](http://json-schema.org/) you are in the right place. If your question/request/change concerns the JSON Schema specification drafts or meta-schemas, please go to [the JSON Schema specification repository](https://github.com/json-schema-org/json-schema-spec). From 833e1f2077e88c221400eb05e98a656732c262d4 Mon Sep 17 00:00:00 2001 From: GitHubPang <61439577+GitHubPang@users.noreply.github.com> Date: Wed, 24 Feb 2021 10:18:23 +0800 Subject: [PATCH 017/206] Change http link into https in CONTRIBUTING.md Co-authored-by: Jason Desrosiers --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77556cc1..bd6dde57 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,3 @@ Thank you for your interest in contributing to JSON Schema! Your participation is appreciated! -If your question/request/change concerns the [JSON Schema Website](http://json-schema.org/) you are in the right place. If your question/request/change concerns the JSON Schema specification drafts or meta-schemas, please go to [the JSON Schema specification repository](https://github.com/json-schema-org/json-schema-spec). +If your question/request/change concerns the [JSON Schema Website](https://json-schema.org/) you are in the right place. If your question/request/change concerns the JSON Schema specification drafts or meta-schemas, please go to [the JSON Schema specification repository](https://github.com/json-schema-org/json-schema-spec). From 6891927e8673e8652e21b4c2c2818d87cc53a4f8 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Sat, 27 Feb 2021 12:14:30 +0000 Subject: [PATCH 018/206] Update schema.md --- schema.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.md b/schema.md index e433ffa8..056a8079 100644 --- a/schema.md +++ b/schema.md @@ -1,3 +1,3 @@ --- -redirect_to: /draft/2019-09/schema +redirect_to: /draft/2020-12/schema --- From cf7a2f44eeb62ba6a6e35a3de7a6b84476a0b676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Machist=C3=A9=20N=2E=20Quintana?= Date: Sat, 13 Mar 2021 10:59:13 -0500 Subject: [PATCH 019/206] Fix jsonschema-rs Python bindings URL in validator list --- _data/validator-libraries-modern.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 34e9db7f..345cf4ec 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -202,7 +202,7 @@ draft: [7, 6, 4] license: BSD-3-Clause - name: jsonschema-rs - url: https://github.com/Stranger6667/jsonschema-rs/python + url: https://github.com/Stranger6667/jsonschema-rs/tree/master/bindings/python notes: Python bindings to Rust's jsonschema crate date-draft: draft: [7, 6, 4] From 36c74089e91e4e36d1b3950bdcbe922e7c94758f Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Thu, 18 Mar 2021 22:58:39 +0000 Subject: [PATCH 020/206] Update slack invite link --- slack.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slack.md b/slack.md index 2dc08825..dd736185 100644 --- a/slack.md +++ b/slack.md @@ -1,3 +1,3 @@ --- -redirect_to: https://join.slack.com/t/json-schema/shared_invite/enQtNjc5NTk0MzkzODg5LTVlZGIxNmVhMGY2MWFlYTdiNDQ5NWFiZGUwOThhNmYxZDE0YzA5YjRiOTA5MGY4ZTZlZGZhZDFmYTY4NWM2N2Y +redirect_to: https://join.slack.com/t/json-schema/shared_invite/zt-nv0vbdfq-Ba_zz2cZBe_26ZoU7fEYGg --- From be41466e3c21397bdfe56ef5cd4fbc5c7ca310a2 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Sun, 28 Mar 2021 18:12:47 +0100 Subject: [PATCH 021/206] ajv draft-2020-12 support --- _data/validator-libraries-modern.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 34e9db7f..f0257fce 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -134,7 +134,7 @@ - name: ajv url: https://github.com/ajv-validator/ajv notes: "for Node.js and browsers - supports [user-defined keywords](https://github.com/ajv-validator/ajv/blob/master/docs/keywords.md) and [$data reference](https://github.com/json-schema-org/json-schema-spec/issues/51)" - date-draft: [2019-09] + date-draft: [2019-09, 2020-12] draft: [7, 6, 4] license: MIT - name: djv From 0940525245b2bff37de46948ce77bca96a547b76 Mon Sep 17 00:00:00 2001 From: Mark Jacobson <52427991+marksparkza@users.noreply.github.com> Date: Thu, 1 Apr 2021 13:02:38 +0200 Subject: [PATCH 022/206] Add jschon to list of Python validators --- _data/validator-libraries-modern.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 34e9db7f..fd9d4a86 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -207,6 +207,12 @@ date-draft: draft: [7, 6, 4] license: MIT + - name: jschon + url: https://github.com/marksparkza/jschon + notes: + date-draft: [2019-09, 2020-12] + draft: + license: MIT - name: Ruby implementations: - name: JSONSchemer From a5c39c1e562790bee580dce78fedf3799289d241 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Thu, 1 Apr 2021 12:17:53 +0100 Subject: [PATCH 023/206] Change ordering for python implementations New implementations with newer support should go at the top! --- _data/validator-libraries-modern.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index fd9d4a86..30c53620 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -189,6 +189,12 @@ license: "MIT" - name: Python implementations: + - name: jschon + url: https://github.com/marksparkza/jschon + notes: + date-draft: [2019-09, 2020-12] + draft: + license: MIT - name: jsonschema url: https://github.com/Julian/jsonschema notes: @@ -207,12 +213,6 @@ date-draft: draft: [7, 6, 4] license: MIT - - name: jschon - url: https://github.com/marksparkza/jschon - notes: - date-draft: [2019-09, 2020-12] - draft: - license: MIT - name: Ruby implementations: - name: JSONSchemer From 1d4ba3d21d4c44302d93aa1678e7fd3a967f7bfb Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Thu, 1 Apr 2021 12:02:44 -0700 Subject: [PATCH 024/206] move more recent draft implementation up top --- _data/validator-libraries-modern.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 30c53620..a9216511 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -162,17 +162,17 @@ license: MIT - name: Perl implementations: + - name: JSON::Schema::Draft201909 + url: https://github.com/karenetheridge/JSON-Schema-Draft201909 + notes: + date-draft: [2019-09] + license: "GNU General Public License, Version 1 + The Artistic License 1.0" - name: JSON::Validator url: https://github.com/mojolicious/json-validator notes: date-draft: draft: [7, 6, 4] license: "The Artistic License 2.0 (GPL Compatible)" - - name: JSON::Schema::Draft201909 - url: https://github.com/karenetheridge/JSON-Schema-Draft201909 - notes: - date-draft: [2019-09] - license: "GNU General Public License, Version 1 + The Artistic License 1.0" - name: PHP implementations: - name: Opis Json Schema From a68bee558698af31ec13dae31d2089ac74c28a7a Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Thu, 1 Apr 2021 12:03:25 -0700 Subject: [PATCH 025/206] add link to new perl implementation JSON::Schema::Tiny --- _data/validator-libraries-modern.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index a9216511..f142e1e8 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -167,6 +167,11 @@ notes: date-draft: [2019-09] license: "GNU General Public License, Version 1 + The Artistic License 1.0" + - name: JSON::Schema::Tiny + url: https://github.com/karenetheridge/JSON-Schema-Tiny + notes: + date-draft: [2019-09] + license: "GNU General Public License, Version 1 + The Artistic License 1.0" - name: JSON::Validator url: https://github.com/mojolicious/json-validator notes: From c1cce99edc276389fee1a8f41fb8b1ef1a753b6b Mon Sep 17 00:00:00 2001 From: Eric Moyer Date: Fri, 16 Apr 2021 14:02:36 -0400 Subject: [PATCH 026/206] Add jsonschema2pojo and jsonschematypes Add jsonschema2pojo and jsonschematypes as Java code generators (jsonschematypes was already under Typescript generators but is called "jsongenerator" there) --- implementations.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/implementations.md b/implementations.md index 5f9e7e52..3ffe3621 100644 --- a/implementations.md +++ b/implementations.md @@ -155,6 +155,8 @@ are the only keywords that changed. - [json-schema-to-elm](https://github.com/dragonwasrobot/json-schema-to-elm) - generates Elm types, JSON decoders+encoders, and fuzz tests from one or more JSON Schema files, using [dragonwasrobot/json_schema](https://github.com/dragonwasrobot/json_schema) *supports Draft 7* - Java - [jsonCodeGen](https://github.com/schlothauer-wauer/jsoncodegen) (MIT) - Groovy based generation tasks from JSON schema. Already includes templates/generators for Java Beans, Swagger specification files and PlantUML diagrams. + - [jsonschema2pojo](https://github.com/joelittlejohn/jsonschema2pojo) (Apache 2.0) - generates Java types from JSON Schema (or example JSON) and can annotate those types for data-binding with Jackson 2.x or Gson. *draft-07* + - [jsonschematypes](https://github.com/jimblackler/jsonschematypes) (Apache 2.0) - Java library to generate Java or TypeScript classes from standard JSON Schemas. *JSON Schema 2019-09, draft-07, -06, -04, -03* - [jsongenerator](https://github.com/jimblackler/jsonschematypes/tree/master/codegen) *JSON Schema 2019-09, draft-07, -06, -04, -03* (Apache-2.0) - Online (web tool) - [quicktype.io](https://app.quicktype.io/#l=schema) - infer JSON Schema from samples, and generate TypeScript, C++, go, Java, C#, Swift, etc. types from JSON Schema @@ -313,4 +315,4 @@ Hyper-Schema {% endfor %} - \ No newline at end of file + From 66969467feb494dcc02247a431a1905a6f283baf Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Tue, 4 May 2021 14:49:24 +0100 Subject: [PATCH 027/206] Add implementation disclaimer. Noted that the implementation listing does not signify endorsement --- implementations.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/implementations.md b/implementations.md index 5f9e7e52..05ffdbbf 100644 --- a/implementations.md +++ b/implementations.md @@ -19,6 +19,8 @@ Implementations are classified based on their functionality. When known, the lic If you have updates to this list, make a pull request on the [GitHub repo](https://github.com/json-schema-org/json-schema-org.github.io). +Listing does not signify a recommendation or endorsement of any kind. + Validators ---------- @@ -313,4 +315,4 @@ Hyper-Schema {% endfor %} - \ No newline at end of file + From 47d460a2630afb9f95637d8f419886e1e916548b Mon Sep 17 00:00:00 2001 From: Peter Wall Date: Tue, 18 May 2021 21:30:30 +1000 Subject: [PATCH 028/206] Removed 2019-09 from supported drafts, added to codegen generated types --- _data/validator-libraries-modern.yml | 2 +- implementations.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 6c37bd84..5150d4c1 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -130,7 +130,7 @@ - name: json-kotlin-schema url: https://github.com/pwall567/json-kotlin-schema notes: Kotlin implementation of JSON Schema - date-draft: [2019-09] + date-draft: draft: [7] license: MIT - name: JavaScript diff --git a/implementations.md b/implementations.md index 9e44db92..8e4ca800 100644 --- a/implementations.md +++ b/implementations.md @@ -197,7 +197,7 @@ are the only keywords that changed. - Java - [jsonCodeGen](https://github.com/schlothauer-wauer/jsoncodegen) (MIT) - Groovy based generation tasks from JSON schema. Already includes templates/generators for Java Beans, Swagger specification files and PlantUML diagrams. - Kotlin - - [json-kotlin-schema-codegen](https://github.com/pwall567/json-kotlin-schema-codegen) (MIT) - Generates Kotlin data classes from JSON Schema. + - [json-kotlin-schema-codegen](https://github.com/pwall567/json-kotlin-schema-codegen) (MIT) - Generates Kotlin data classes, Java classes or TypeScript interfaces from JSON Schema. - Online (web tool) - [quicktype.io](https://app.quicktype.io/#l=schema) - infer JSON Schema from samples, and generate TypeScript, C++, go, Java, C#, Swift, etc. types from JSON Schema - PHP From 5e72ef0e10b9d5c8021e9b9a8e41796262b9e2be Mon Sep 17 00:00:00 2001 From: Peter Wall Date: Fri, 21 May 2021 19:46:31 +1000 Subject: [PATCH 029/206] Added notes on coverage of specific drafts --- _data/validator-libraries-modern.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index fbdab964..5a78ee4a 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -137,7 +137,10 @@ license: Apache License 2.0 - name: json-kotlin-schema url: https://github.com/pwall567/json-kotlin-schema - notes: Kotlin implementation of JSON Schema + notes: | + Kotlin implementation of JSON Schema. + (Currently supports most of Draft 7; see the README for details. + Full compliance with Draft 7 and later drafts in progress.) date-draft: draft: [7] license: MIT From 96661020f66aedfde4b83ae04f0ccb8709a2aa76 Mon Sep 17 00:00:00 2001 From: AF <58430604+Liquid-Technologies@users.noreply.github.com> Date: Mon, 24 May 2021 08:42:38 +0100 Subject: [PATCH 030/206] Update implementations.md Added new links --- implementations.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/implementations.md b/implementations.md index 7f93d149..c5966913 100644 --- a/implementations.md +++ b/implementations.md @@ -132,6 +132,7 @@ For example, the only incompatibilities between draft-04 and draft-06 involve `e - [luposlip/json-schema](https://github.com/luposlip/json-schema) (Apache 2.0) - infer JSON Schema from Clojure data - Online (web tool) - [jsonschema.net](https://www.jsonschema.net/) - generates schemas from example data + - [Liquid Online Tools](https://www.liquid-technologies.com/online-json-to-schema-converter) - infer JSON Schema from sample JSON data - [quicktype.io](https://app.quicktype.io/#l=schema) - infer JSON Schema from samples, and generate TypeScript, C++, go, Java, C#, Swift, etc. types from JSON Schema Generators from schemas @@ -256,6 +257,7 @@ _None currently support draft-06 or later._ - [Dashjoin JSON Schema editor](https://dashjoin.github.io/#/schema) - *Graphical online JSON Schema editor for draft-06 (minus oneOf, anyOf, allOf, not). The generated schema can be tested immediately via a form that is driven by it.* - [JSONBuddy](https://www.json-buddy.com/) - *Text and grid-style JSON editor and validator with context sensitive entry-helpers and sample data generation based on JSON schema. Support for draft-4, draft-6 and draft-7.* - [JSONEditor Online](https://jsoneditoronline.org/) - *View, edit, format, and validate JSON online* Support draft-4, draft-6, and draft-7. +- [Liquid JSON Schema Editor](https://www.liquid-technologies.com/json-schema-editor) - *Graphical JSON Schema editor for draft-04, draft-06, draft-07 and 2019-09, with split source code and grphical editing. Includes validation of JSON files based on JSON Schema, JSON Sample Generator and JSON Schema Documentation Generator.* - [Oxygen JSON Editor](https://www.oxygenxml.com/xml_editor/json.html) - *JSON editor with a variety of editing features and helper views. Support for validation and editing JSON Schema draft-4, draft-6, and draft-7. Validation and editing of JSON files based on JSON Schema.* - [Stoplight Studio](https://stoplight.io/) - *JSON Schema IDE (text-based and GUI) with support for JSON/YAML linting, which can also be based on JSON Schema rules via Spectral. Support for draft-4, draft-6 and draft-7.* - [Visual Studio Code](https://code.visualstudio.com/) - *Schema driven code completion, hovers and validation for editing JSON files (including schemas)* From efcf9db788e5e3c79e3e14c4245a727fecba2559 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Mon, 31 May 2021 19:51:15 -0700 Subject: [PATCH 031/206] Develop locally with docker --- .gitignore | 2 ++ README.md | 33 +++++++++++---------------------- docker-compose.yml | 11 +++++++++++ 3 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore index 6fe13fcd..778ea372 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ _site/ node_modules/ .vscode/ +.jekyll-metadata +vendor/ diff --git a/README.md b/README.md index 72766976..2a457cd9 100644 --- a/README.md +++ b/README.md @@ -19,28 +19,17 @@ Labels are assigned based on [Sensible Github Labels](https://github.com/Releque ## Compile and run locally This site runs via github pages, with automatically building PR previews via netlify. -If you wish to compile and run this site locally, you will need to have ruby installed. - -If you're not familiar with ruby, consider using `rvm` (https://rvm.io/). -Once you have Ruby installed, follow these instructions while in the project directory - -> Instructions -> -> 1. Install the jekyll and bundler gems. -> -> `gem install jekyll bundler` -> -> 2. Create a new Jekyll site at ./myblog. -> -> ... -> -> 3. Build the site and make it available on a local server. -> -> `bundle exec jekyll serve` -> -> 4. Browse to http://localhost:4000 - -Adapted from https://jekyllrb.com/docs/ + +This project uses git submodules, so you will need to run the following commands +to fully clone the repo. + +```bash +git submodule init +git submodule update +``` + +You can run the site locally using `docker-compose up` and browse to +http://localhost:4000 ## License diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..9b51565a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: "3.9" + +services: + web: + image: docker.io/jekyll/jekyll + volumes: + - .:/srv/jekyll:Z + - ./vendor/bundle:/usr/local/bundle:Z + ports: + - "4000:4000" + command: jekyll serve --incremental --watch From 8dd01ecd93a5689de22d9e58af36003d0ac7ca95 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Mon, 7 Jun 2021 11:09:33 -0700 Subject: [PATCH 032/206] Remove duplicates from obsolete-implemenetations page --- implementations.md | 2 -- obsolete-implementations.md | 15 --------------- 2 files changed, 17 deletions(-) diff --git a/implementations.md b/implementations.md index c5966913..df4c6b89 100644 --- a/implementations.md +++ b/implementations.md @@ -152,8 +152,6 @@ are the only keywords that changed. #### Code generation -- Delphi - - [DJsonSchema](https://github.com/schlothauer-wauer/DJsonSchema) (MIT) - JSON Schema reader and code generator for Delphi. - Elm - [json-schema-to-elm](https://github.com/dragonwasrobot/json-schema-to-elm) - generates Elm types, JSON decoders+encoders, and fuzz tests from one or more JSON Schema files, using [dragonwasrobot/json_schema](https://github.com/dragonwasrobot/json_schema) *supports Draft 7* - Java diff --git a/obsolete-implementations.md b/obsolete-implementations.md index 2950d504..86af9e19 100644 --- a/obsolete-implementations.md +++ b/obsolete-implementations.md @@ -77,12 +77,9 @@ Validators - JavaScript - - [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark) - an independent benchmark for Node.js JSON-schema validators based on JSON-Schema Test Suite (MIT) - [z-schema validator benchmark](https://github.com/zaggino/z-schema#benchmarks) - compares performance in the individual tests from JSON-Schema Test Suite (MIT) - [JSCK validator benchmark](https://github.com/pandastrike/jsck#benchmarks) - shows performance for JSON-schemas of different complexity (MIT) -- PHP - - [php-json-schema-bench](https://github.com/swaggest/php-json-schema-bench) - comparative benchmark for JSON-schema PHP validators using JSON-Schema Test Suite and z-schema/JSCK (MIT) Hyper-Schema --------------------- @@ -149,8 +146,6 @@ Data Parsing and Code Generation - Delphi - [DJsonSchema](https://github.com/schlothauer-wauer/DJsonSchema) (MIT) - JSON Schema reader and code generator for Delphi. -- Groovy - - [jsonCodeGen](https://github.com/schlothauer-wauer/jsoncodegen) (MIT) - Groovy based generation tasks from JSON schema. Already includes generators for Java Beans, Swagger specification files and PlantUML diagrams. - Haskell - [aeson-schema](https://github.com/Fuuzetsu/aeson-schema) (MIT) - generates code for a parser - Ruby @@ -171,19 +166,11 @@ _TODO: Sort by draft support._ Various levels of support for UI generation primarily from the validation vocabulary or combined with UI specific definition. - JavaScript - - [Alpaca Forms](http://www.alpacajs.org/) (ASL 2.0) - - [Angular Schema Form](https://github.com/json-schema-form/angular-schema-form) (MIT) - - [Angular2 Schema Form](https://github.com/makinacorpus/angular2-schema-form) *unrelated to Angular Schema Form* (MIT) - [JSON Editor](https://github.com/jdorn/json-editor) (MIT) - - [JSON Form](https://github.com/joshfire/jsonform) (joshfire) (MIT) - - [Json Forms](https://github.com/brutusin/json-forms) (brutusin) (MIT) - [JSONForms](http://jsonforms.io) (EclipseSource) (MIT) - [Jsonary](http://jsonary.com/) (MIT) - - [Liform-react](https://github.com/Limenius/liform-react) (MIT) - [Metawidget](http://metawidget.org/) (LGPL) - [pure-form webcomponent](https://github.com/john-doherty/pure-form) (MIT) - - [React JSON Schema Form](https://github.com/mozilla-services/react-jsonschema-form) (Apache 2) - - [React Schema Form](https://github.com/networknt/react-schema-form) (MIT) Editors ------- @@ -216,5 +203,3 @@ Other - JavaScript - [Dojo](http://www.dojotoolkit.org/) (AFL or BSD) - supports some aspects of JSON Schema - [JSON Schema Random](https://github.com/andreineculau/json-schema-random) (Apache 2.0) - - [json-schema-merge-allof](https://github.com/mokkabonna/json-schema-merge-allof) (MIT) - - [json-schema-compare](https://github.com/mokkabonna/json-schema-compare) (MIT) From 9720b71e7584c9c91f04f5009579dfd6d16bba38 Mon Sep 17 00:00:00 2001 From: Mark Jacobson <52427991+marksparkza@users.noreply.github.com> Date: Thu, 10 Jun 2021 14:01:39 +0200 Subject: [PATCH 033/206] Add jschon.dev online validator --- _data/validator-libraries-modern.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index fc257fff..61b07912 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -278,6 +278,10 @@ date-draft: [2019-09, 2020-12] draft: [7, 6, 4] notes: Supports multiple schemas and multiple instances + - name: jschon.dev + url: https://jschon.dev/ + date-draft: [2019-09, 2020-12] + draft: - name: JSON Schema Validator url: https://www.jsonschemavalidator.net/ date-draft: [2019-09] From ec2cfe99c687380b43779b77ef221e2456c61876 Mon Sep 17 00:00:00 2001 From: Clemens Uhlenhut Date: Sat, 12 Jun 2021 15:02:08 +0200 Subject: [PATCH 034/206] Update implementations.md Added support for draft 2019-09 to JSONBuddy --- implementations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implementations.md b/implementations.md index c5966913..8af55d21 100644 --- a/implementations.md +++ b/implementations.md @@ -255,7 +255,7 @@ _None currently support draft-06 or later._ - [Altova XMLSpy 2019r3](https://www.altova.com/xmlspy-xml-editor#json_schema) - *Graphical JSON Schema editor for draft-06 and draft-7, as well as validation of JSON files based on JSON Schema* - [Dashjoin JSON Schema editor](https://dashjoin.github.io/#/schema) - *Graphical online JSON Schema editor for draft-06 (minus oneOf, anyOf, allOf, not). The generated schema can be tested immediately via a form that is driven by it.* -- [JSONBuddy](https://www.json-buddy.com/) - *Text and grid-style JSON editor and validator with context sensitive entry-helpers and sample data generation based on JSON schema. Support for draft-4, draft-6 and draft-7.* +- [JSONBuddy](https://www.json-buddy.com/) - *Text and grid-style JSON editor and validator with JSON schema analyzer, context sensitive entry-helpers and sample data generation based on JSON schema. Support for draft-4, draft-6, draft-7 and 2019-09.* - [JSONEditor Online](https://jsoneditoronline.org/) - *View, edit, format, and validate JSON online* Support draft-4, draft-6, and draft-7. - [Liquid JSON Schema Editor](https://www.liquid-technologies.com/json-schema-editor) - *Graphical JSON Schema editor for draft-04, draft-06, draft-07 and 2019-09, with split source code and grphical editing. Includes validation of JSON files based on JSON Schema, JSON Sample Generator and JSON Schema Documentation Generator.* - [Oxygen JSON Editor](https://www.oxygenxml.com/xml_editor/json.html) - *JSON editor with a variety of editing features and helper views. Support for validation and editing JSON Schema draft-4, draft-6, and draft-7. Validation and editing of JSON files based on JSON Schema.* From f42dd18ed57a38c6dec099dc426a84878fca2f79 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Sat, 29 May 2021 13:01:59 -0700 Subject: [PATCH 035/206] Release Notes: Unlrelated fixes --- draft/2019-09/release-notes.md | 2 -- specification-links.md | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/draft/2019-09/release-notes.md b/draft/2019-09/release-notes.md index 0f5c933d..0583b94f 100644 --- a/draft/2019-09/release-notes.md +++ b/draft/2019-09/release-notes.md @@ -3,8 +3,6 @@ title: JSON Schema 2019-09 Release Notes layout: page --- -_NOTE: This page is still being written, and is currently a fairly minimal listing of changes._ - For the vast majority of schema authors, we hope that these changes are minimally disruptive. The most likely to be frustrating is that `format` is no longer treated as a validation assertion _by default_ (although it is still possible for an application or user to configure a validator to treat it as one). We decided this was acceptable because many schema authors are already extremely frustrated by its inconsistent behavior. diff --git a/specification-links.md b/specification-links.md index 6f3de025..c891aed5 100644 --- a/specification-links.md +++ b/specification-links.md @@ -307,12 +307,10 @@ For links to the somewhat more readably formatted versions on this web site, and - Output examples - [JSON Schema verbose output example](draft/2020-12/output/verbose-example) -### 2019-09 (formerly known as Draft 8) +### Draft 2019-09 (formerly known as Draft 8) _**NOTE:** All meta-schema URIs now use `https://`. While currently also available over plain HTTP due to the limitations of GitHub pages and the need to keep prior drafts available over HTTP, only the HTTPS URIs should be used._ -### Draft 2019-09 - - Specifications - Core: [draft-handrews-json-schema-02](https://tools.ietf.org/html/draft-handrews-json-schema-02) ([changes](https://tools.ietf.org/html/draft-handrews-json-schema-02#appendix-G)) - Validation: [draft-handrews-json-schema-validation-02](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02) ([changes](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#appendix-C)) From bd73d0a3e088c8d370eb6983ef49832a3a0fb4a1 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Mon, 31 May 2021 19:08:15 -0700 Subject: [PATCH 036/206] Release Notes: Init 2020-12 release notes page --- draft/2020-12/release-notes.md | 4 ---- specification.md | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/draft/2020-12/release-notes.md b/draft/2020-12/release-notes.md index ed8cfc6e..372548d4 100644 --- a/draft/2020-12/release-notes.md +++ b/draft/2020-12/release-notes.md @@ -2,7 +2,3 @@ title: JSON Schema 2020-12 Release Notes layout: page --- - -_NOTE: This page is still being written._ - -You can find a minimal changelog at the end of the specification documents themselves. \ No newline at end of file diff --git a/specification.md b/specification.md index ef7b156f..63f9d73a 100644 --- a/specification.md +++ b/specification.md @@ -67,8 +67,8 @@ Migrating from older drafts The release notes discuss the changes impacting users and implementers: - JSON Schema Core and Validation - - 2019-09 to 2020-12 (Work in progress - 2021-02-01) - - [Draft-07 to 2019-09](draft/2019-09/release-notes.html) + - [Draft 2019-09 to Draft 2020-12](draft/2020-12/release-notes.html) + - [Draft-07 to Draft 2019-09](draft/2019-09/release-notes.html) - [Draft-06 to Draft-07](draft-07/json-schema-release-notes.html) - [Draft-04 to Draft-06](draft-06/json-schema-release-notes.html) - JSON Hyper-Schema From da05d901497487d628d2456f098ee9404a350c00 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Sat, 29 May 2021 13:10:32 -0700 Subject: [PATCH 037/206] Release Notes: tuple items changes --- draft/2020-12/release-notes.md | 100 +++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/draft/2020-12/release-notes.md b/draft/2020-12/release-notes.md index 372548d4..4fb7c5c2 100644 --- a/draft/2020-12/release-notes.md +++ b/draft/2020-12/release-notes.md @@ -2,3 +2,103 @@ title: JSON Schema 2020-12 Release Notes layout: page --- +## Changes to items and additionalItems +The keywords used for defining arrays and tuples have been redesigned to help +lower the learning curve for JSON Schema. Since the `items` keyword was used for +both types, we would often see people mistakenly defining a tuple when they +meant to define an array and not understand why only the first item in the array +was validating. + +The `items` and `additionalItems` keywords have been replaced with `prefixItems` +and `items` where `prefixItems` has the same functionality as the +array-of-schemas for of the old `items` and the new `items` keyword has the same +functionality as the old `additionalItems` keyword. + +Although the meaning of `items` has changed, the syntax for defining arrays +remains the same. Only the syntax for defining tuples has changed. The idea is +that an array has items (`items`) and optionally has some positionally defined +items that come before the normal items (`prefixItems`). + +Here are some examples to illustrate the changes. + +### Open tuple + + + + + + + + + +
Draft 2019-09Draft 2020-12
+
{
+  "items": [
+    { "$ref": "#/$defs/foo" },
+    { "$ref": "#/$defs/bar" }
+  ]
+}
+
+
{
+  "prefixItems": [
+    { "$ref": "#/$defs/foo" },
+    { "$ref": "#/$defs/bar" }
+  ]
+}
+
+ +### Closed tuple + + + + + + + + + +
Draft 2019-09Draft 2020-12
+
{
+  "items": [
+    { "$ref": "#/$defs/foo" },
+    { "$ref": "#/$defs/bar" }
+  ],
+  "additionalItems": false
+}
+
+
{
+  "prefixItems": [
+    { "$ref": "#/$defs/foo" },
+    { "$ref": "#/$defs/bar" }
+  ],
+  "items": false
+}
+
+ +### Tuple with constrained additional items + + + + + + + + + +
Draft 2019-09Draft 2020-12
+
{
+  "items": [
+    { "$ref": "#/$defs/foo" },
+    { "$ref": "#/$defs/bar" }
+  ],
+  "additionalItems": { "$ref": "#/$defs/baz" }
+}
+
+
{
+  "prefixItems": [
+    { "$ref": "#/$defs/foo" },
+    { "$ref": "#/$defs/bar" }
+  ],
+  "items": { "$ref": "#/$defs/baz" }
+}
+
From a151a916c6434468e68d5e9ea2f7b3f1ffa08357 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Mon, 31 May 2021 19:06:26 -0700 Subject: [PATCH 038/206] Release Notes: Dyanmic keywords --- draft/2020-12/release-notes.md | 82 ++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/draft/2020-12/release-notes.md b/draft/2020-12/release-notes.md index 4fb7c5c2..08311a30 100644 --- a/draft/2020-12/release-notes.md +++ b/draft/2020-12/release-notes.md @@ -102,3 +102,85 @@ Here are some examples to illustrate the changes. + +## $dynamicRef and $dynamicAnchor +The `$recursiveRef` and `$recursiveAnchor` keywords were replaced by the more +powerful `$dynamicRef` and `$dynamicAnchor` keywords. `$recursiveRef` and +`$recursiveAnchor` were introduced in the previous draft to solve the problem of +extending recursive schemas. As the "recursive" keywords got some use and we +understood them better, we discovered how we could generalize them to solve even +more types of problems. The name change reflects that these keywords are useful +for more than just extending recursive schemas. + +A `$dynamicAnchor` can be thought of like a normal `$anchor` except that it can +be referenced across schemas rather than just in the schema it was defined in. +You can think of the old `$recursiveAnchor` as working the same way except that +it only allowed you to create an anchor at the root of the schema and the anchor +name is always empty. + +`$dynamicRef` works the same as the old `$recursiveRef` except that fragments +are no longer empty (`"$dynamicRef": "#my-anchor"` instead of `"$recursiveRef": +"#"`) and non-fragment-only URIs are allowed. When a `$dynamicRef` contains a +non-fragment-only URI-Reference, the schema the URI-Reference resolves to is +used as the starting point for dynamic resolution. + +Here's how you would covert a schema using `$recursiveRef` to use `$dynamicRef`. + + + + + + + + + + +
Draft 2019-09Draft 2020-12
// tree schema, extensible
+{
+  "$schema": "https://json-schema.org/draft/2019-09/schema",
+  "$id": "https://example.com/tree",
+  "$recursiveAnchor": true,
+
+  "type": "object",
+  "properties": {
+    "data": true,
+    "children": {
+      "type": "array",
+      "items": { "$recursiveRef": "#" }
+    }
+  }
+}
+
+// strict-tree schema, guards against misspelled properties
+{
+  "$schema": "https://json-schema.org/draft/2019-09/schema",
+  "$id": "https://example.com/strict-tree",
+  "$recursiveAnchor": true,
+
+  "$ref": "tree",
+  "unevaluatedProperties": false
+}
// tree schema, extensible
+{
+  "$schema": "https://json-schema.org/draft/2020-12/schema",
+  "$id": "https://example.com/tree",
+  "$dynamicAnchor": "node",
+
+  "type": "object",
+  "properties": {
+    "data": true,
+    "children": {
+      "type": "array",
+      "items": { "$dynamicRef": "#node" }
+    }
+  }
+}
+
+// strict-tree schema, guards against misspelled properties
+{
+  "$schema": "https://json-schema.org/draft/2020-12/schema",
+  "$id": "https://example.com/strict-tree",
+  "$dynamicAnchor": "node",
+
+  "$ref": "tree",
+  "unevaluatedProperties": false
+}
From 974488384d0ee7cb83e6c77b2b1d6b665941742d Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Tue, 1 Jun 2021 10:36:45 -0700 Subject: [PATCH 039/206] Release Notes: Apply suggestions for dynamic changes Co-authored-by: Karen Etheridge --- draft/2020-12/release-notes.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/draft/2020-12/release-notes.md b/draft/2020-12/release-notes.md index 08311a30..5e21fc2c 100644 --- a/draft/2020-12/release-notes.md +++ b/draft/2020-12/release-notes.md @@ -113,10 +113,10 @@ more types of problems. The name change reflects that these keywords are useful for more than just extending recursive schemas. A `$dynamicAnchor` can be thought of like a normal `$anchor` except that it can -be referenced across schemas rather than just in the schema it was defined in. -You can think of the old `$recursiveAnchor` as working the same way except that -it only allowed you to create an anchor at the root of the schema and the anchor -name is always empty. +be referenced across schemas rather than just in the schema where it was +defined. You can think of the old `$recursiveAnchor` as working the same way +except that it only allowed you to create one anchor per schema, it had to be at +the root of the schema, and the anchor name is always empty. `$dynamicRef` works the same as the old `$recursiveRef` except that fragments are no longer empty (`"$dynamicRef": "#my-anchor"` instead of `"$recursiveRef": From e13116f85a8c8c4118d63b4895531d800454f1ba Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Mon, 31 May 2021 19:28:53 -0700 Subject: [PATCH 040/206] Release Notes: Vocabulary changes --- draft/2020-12/release-notes.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/draft/2020-12/release-notes.md b/draft/2020-12/release-notes.md index 5e21fc2c..745b2e27 100644 --- a/draft/2020-12/release-notes.md +++ b/draft/2020-12/release-notes.md @@ -184,3 +184,22 @@ Here's how you would covert a schema using `$recursiveRef` to use `$dynamicRef`. } + +## Vocabulary Changes +The `unevaluatedProperties` and `unevaluatedItems` keywords have been moved from +the applicator vocabulary to their own vocabulary designated which is required +in the default meta-schema. In Draft 2019-09, these keywords were expected to +throw an error if not implemented. This was a special-case behavior of the +applicator vocabulary. Moving the "unevaluated" keywords into their own +vocabulary allows us to remove that special-case and also allowing for dialects +to be constructed that don't require these keywords. + +The format vocabulary was broken into two separate vocabularies. The +"format-annotation" vocabulary treats the `format` keyword as an annotation and +the "format-assertion" vocabulary treats the `format` keyword as an assertion. +The "format-annotation" vocabulary is used in the default meta-schema and is +required. In Draft 2019-09, `format` should be evaluated as an annotation by +default and implementations could provide configuration to change the behavior +to evaluate `format` as an assertion. The separate vocabularies allow for +removing the special configuration requirements and just use the vocabulary +system to express which behavior should be used. From 782852c36f92b1aaac1a954d0fbd5b48760a322a Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Tue, 1 Jun 2021 16:09:47 -0700 Subject: [PATCH 041/206] Release Notes: Add section on contains and unevaluatedItems --- draft/2020-12/release-notes.md | 92 ++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/draft/2020-12/release-notes.md b/draft/2020-12/release-notes.md index 745b2e27..164be5e2 100644 --- a/draft/2020-12/release-notes.md +++ b/draft/2020-12/release-notes.md @@ -185,6 +185,98 @@ Here's how you would covert a schema using `$recursiveRef` to use `$dynamicRef`. +## contains and unevaluatedItems +In the previous draft, it wasn't specified how or if the `contains` keyword +affects the `unevaluatedItems` keyword. This draft specifies that any item in an +array that passes validation of the `contains` schema is considered "evaluated". + +This allows you to use `contains` to express some constraints more cleanly than +you could in previous drafts. This example show how you can express an array +that has some item matching one schema and everything else matching another +schema. + + + + + + + + + + +
Draft 2019-09Draft 2020-12
{
+  "type": "array",
+  "contains": { "type": "string" },
+  "items": {
+    "anyOf": [
+      { "type": "string" },
+      { "type": "number" }
+    ]
+  }
+}
{
+  "type": "array",
+  "contains": { "type": "string" },
+  "unevaluatedItems": { "type": "number" }
+}
+
+
+
+
+
+
+ +Unfortunately, this change means you may not be able to use `contains` in some +situations you did before. Consider this draft 2019-09 schema describing a tuple +of two strings where one of the two must be three or more characters long and +any additional items are not allowed. + +```json +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "type": "array", + "items": [{ "type": "string" }, { "type": "string" }], + "contains": { "type": "string", "minLength": 3 }, + "unevaluatedItems": false +} +``` + +Given this schema, the instance `["a", "b", "ccc"]` will fail because `"ccc"` is +considered unevaluated and fails the `unevaluatedItems` keyword. Now let's +naively convert that example to a draft 2020-12 schema. + +```json +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "prefixItems": [{ "type": "string" }, { "type": "string" }], + "contains": { "type": "string", "minLength": 3 }, + "unevaluatedItems": false +} +``` + +Given this schema, the instance `["a", "b", "ccc"]` will pass because `"ccc"` is +considered evaluated and doesn't not apply to the `unevaluatedItems` keyword. To +fix this problem we can use the same boolean algebra transformation we used to +use before we had the `contains` keyword. + +```json +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "prefixItems": [{ "type": "string" }, { "type": "string" }], + "not": { + "items": { + "not": { "type": "string", "minLength": 3 } + } + }, + "unevaluatedItems": false +} +``` + +Given this schema, the instance `["a", "b", "ccc"]` will fail because `"ccc"` is +considered unevaluated and fails the `unevaluatedItems` keyword like it did in +previous drafts. + ## Vocabulary Changes The `unevaluatedProperties` and `unevaluatedItems` keywords have been moved from the applicator vocabulary to their own vocabulary designated which is required From 136110d99c958a00568e420657fe054e99656923 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Thu, 3 Jun 2021 15:48:54 -0700 Subject: [PATCH 042/206] Release Notes: Add section on embedded schemas --- draft/2020-12/release-notes.md | 156 +++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) diff --git a/draft/2020-12/release-notes.md b/draft/2020-12/release-notes.md index 164be5e2..301d0f0b 100644 --- a/draft/2020-12/release-notes.md +++ b/draft/2020-12/release-notes.md @@ -277,6 +277,162 @@ Given this schema, the instance `["a", "b", "ccc"]` will fail because `"ccc"` is considered unevaluated and fails the `unevaluatedItems` keyword like it did in previous drafts. +## Embedded Schemas and Bundling +In Draft 2019-09, the meaning of `$id` in a sub-schema changed from indicating a +base URI change within the current schema to indicating an embedded schema +independent of the parent schema. A schema that contains one or more embedded +schemas is called a "Compound Schema Document". This draft introduces guidance +on how bundlers should embedded schemas to create Compound Schema Documents. + +If you reference an external schema, that schema can declare it's own `$schema` +and that may be different than the `$schema` of the referencing schema. +Implementations need to be prepared to switch processing modes or throw an +error if they don't support the `$schema` of the referenced schema. Embedded +schemas work exactly the same way. They may declare a `$schema` that is not the +same as the parent schema and implementations need to be prepared to handle the +`$schema` change appropriately. + +A notable consequence of embedded schemas having a different `$schema` than its +parent is that implementations can't validate Compound Schema Documents directly +against the meta-schema. The Compound Schema Document needs to be decomposed and +each Schema Resource needs to be validated individually against the appropriate +meta-schema for that schema. + +This draft introduces official guidance on how to use embedded schemas to +bundle schemas into a Compound Schema Document. The approach is designed to not +have to modify schemas (other than adding to `$defs`) so that output results +remain as similar as possible whether you are validating the bundled schema or +following external references. Here's an example of a customer schema with +external references that we want to bundle. + +```json +{ + "$schema": "https://json-schema.org/draft/2020-12", + "$id": "https://example.com/schema/customer", + + "type": "object", + "properties": { + "name": { "type": "string" }, + "phone": { "$ref": "/schema/common#/$defs/phone" }, + "address": { "$ref": "/schema/address" } + } +} +``` + +```json +{ + "$schema": "https://json-schema.org/draft/2020-12", + "$id": "https://example.com/schema/address", + + "type": "object", + "properties": { + "address": { "type": "string" }, + "city": { "type": "string" }, + "postalCode": { "type": "/schema/common#/$defs/usaPostalCode" }, + "state": { "type": "/$defs/states" } + }, + + "$defs": { + "states": { + "enum": [...] + } + } +} +``` + +```json +{ + "$schema": "https://json-schema.org/draft/2019-09", + "$id": "https://example.com/schema/common", + + "$defs": { + "phone": { + "type": "string", + "pattern": "^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$" + }, + "usaPostalCode": { + "type": "string", + "pattern": "^[0-9]{5}(?:-[0-9]{4})?$" + }, + "unsignedInt": { + "type": "integer", + "minimum": 0 + } + } +} +``` + +To bundle these schemas, we simply add each of the referenced schemas as +embedded schemas using `$defs`. Here's what the bundled schema would look like. + +```json +{ + "$schema": "https://json-schema.org/draft/2020-12", + "$id": "https://example.com/schema/customer", + + "type": "object", + "properties": { + "name": { "type": "string" }, + "phone": { "$ref": "/schema/common#/$defs/phone" }, + "address": { "$ref": "/schema/address" } + } + + "$defs": { + "https://example.com/schema/address": { + "$id": "https://example.com/schema/address", + + "type": "object", + "properties": { + "address": { "type": "string" }, + "city": { "type": "string" }, + "postalCode": { "type": "/schema/common#/$defs/usaPostalCode" }, + "state": { "type": "#/$defs/states" } + }, + + "$defs": { + "states": { + "enum": [...] + } + } + }, + "$id": "https://example.com/schema/common": { + "$schema": "https://json-schema.org/draft/2019-09", + "$id": "https://example.com/schema/common", + + "$defs": { + "phone": { + "type": "string", + "pattern": "^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$" + }, + "usaPostalCode": { + "type": "string", + "pattern": "^[0-9]{5}(?:-[0-9]{4})?$" + }, + "unsignedInt": { + "type": "integer", + "minimum": 0 + } + } + } + } +} +``` + +Here are a few things you might notice from this example. + +1. No `$ref`s were modified. Even local references are unchanged. +2. `https://example.com/schema/common#/$defs/unsignedInt` got pulled in with the +common schema even though it isn't used. It's allowed to trim out the extra +definitions, but not necessary. +3. `https://example.com/schema/address` doesn't declare a `$schema`. Because it +uses the same `$schema` as `https://example.com/schema/customer`, it can skip +that declaration and use the `$schema` from the schema it's embedded in. +4. `https://example.com/schema/common` uses a different `$schema` than the +document it's embedded in. That's allowed. +5. Definitions from `https://example.com/schema/common` are used in both of the +other schemas and only needs to be included once. It isn't necessary for +bundlers to embed a schema inside another embedded schema. + ## Vocabulary Changes The `unevaluatedProperties` and `unevaluatedItems` keywords have been moved from the applicator vocabulary to their own vocabulary designated which is required From e2a52d6f26e603d859493efd60514b8bc600101e Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Fri, 4 Jun 2021 10:49:41 -0700 Subject: [PATCH 043/206] Release Notes: Added an intro and a few smaller sections --- draft/2020-12/release-notes.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/draft/2020-12/release-notes.md b/draft/2020-12/release-notes.md index 301d0f0b..977eabfb 100644 --- a/draft/2020-12/release-notes.md +++ b/draft/2020-12/release-notes.md @@ -2,6 +2,16 @@ title: JSON Schema 2020-12 Release Notes layout: page --- +The previous draft (2019-09) introduced a lot of new concepts including +`$recursiveRef`/`$recursiveAnchor`, `unevaluatedProperties`/`unevaluatedItems`, +vocabularies, and more. Since then, these new features have seen multiple +implementations and usage in real schemas. This draft is mostly dedicated to +changes related to applying the lessons we've learned about implementing and +using these new features in the wild. + +This document attempts to put information most useful to schema authors toward +the top and information for implementation authors toward the bottom. + ## Changes to items and additionalItems The keywords used for defining arrays and tuples have been redesigned to help lower the learning curve for JSON Schema. Since the `items` keyword was used for @@ -277,6 +287,18 @@ Given this schema, the instance `["a", "b", "ccc"]` will fail because `"ccc"` is considered unevaluated and fails the `unevaluatedItems` keyword like it did in previous drafts. +## Regular Expressions +Regular expressions are now required to support unicode characters. Previously, +this was unspecified and implementations may or may not support this unicode in +regular expressions. + +## Media Type Changes +JSON Schema defines two media types, `application/schema+json` and +`application/schema-instance+json`. This draft drops support for the `schema` +media type parameter. It's caused a lot of confusion and disagreement. Since we +haven't seen any evidence of anyone actually using it, it was decided to remove +it for now. + ## Embedded Schemas and Bundling In Draft 2019-09, the meaning of `$id` in a sub-schema changed from indicating a base URI change within the current schema to indicating an embedded schema @@ -433,6 +455,11 @@ document it's embedded in. That's allowed. other schemas and only needs to be included once. It isn't necessary for bundlers to embed a schema inside another embedded schema. +## Annotations +Implementations that collect annotations should now include annotations for +unknown keywords in the "verbose" output format. The annotation value for an +unknown keyword is the keyword's value. + ## Vocabulary Changes The `unevaluatedProperties` and `unevaluatedItems` keywords have been moved from the applicator vocabulary to their own vocabulary designated which is required From 52f390e0b5e5d2cf4040a648cc6ae5f15a172884 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Thu, 1 Jul 2021 22:17:14 -0700 Subject: [PATCH 044/206] small typo fixes --- draft/2020-12/release-notes.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/draft/2020-12/release-notes.md b/draft/2020-12/release-notes.md index 977eabfb..742a5009 100644 --- a/draft/2020-12/release-notes.md +++ b/draft/2020-12/release-notes.md @@ -306,7 +306,7 @@ independent of the parent schema. A schema that contains one or more embedded schemas is called a "Compound Schema Document". This draft introduces guidance on how bundlers should embedded schemas to create Compound Schema Documents. -If you reference an external schema, that schema can declare it's own `$schema` +If you reference an external schema, that schema can declare its own `$schema` and that may be different than the `$schema` of the referencing schema. Implementations need to be prepared to switch processing modes or throw an error if they don't support the `$schema` of the referenced schema. Embedded @@ -417,7 +417,7 @@ embedded schemas using `$defs`. Here's what the bundled schema would look like. } } }, - "$id": "https://example.com/schema/common": { + "https://example.com/schema/common": { "$schema": "https://json-schema.org/draft/2019-09", "$id": "https://example.com/schema/common", @@ -462,7 +462,7 @@ unknown keyword is the keyword's value. ## Vocabulary Changes The `unevaluatedProperties` and `unevaluatedItems` keywords have been moved from -the applicator vocabulary to their own vocabulary designated which is required +the applicator vocabulary to their own designated vocabulary which is required in the default meta-schema. In Draft 2019-09, these keywords were expected to throw an error if not implemented. This was a special-case behavior of the applicator vocabulary. Moving the "unevaluated" keywords into their own From a7ae96b63025a36ccdfef524e36161d9233ff6f1 Mon Sep 17 00:00:00 2001 From: Iwan Aucamp Date: Sun, 4 Jul 2021 21:23:47 +0200 Subject: [PATCH 045/206] Clarify the meaning of the draft qualifier --- index.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/index.md b/index.md index b4a512cc..c85c7833 100644 --- a/index.md +++ b/index.md @@ -65,10 +65,19 @@ In the meantime, publication of Internet-Draft documents can be tracked through * [Relative JSON Pointers](https://datatracker.ietf.org/doc/draft-bhutton-relative-json-pointer/) Internet-Drafts expire after six months, so our goal is to publish often enough to always have a set of unexpired drafts available. There may be brief gaps as we wrap up each draft and finalize the text. +
-The intention, particularly for vocabularies such as validation which have been widely implemented, is to remain as compatible as possible from draft to draft. However, these are still drafts, and given a clear enough need validated with the user community, major changes can occur. +### Use of the _draft_ qualifier - +Releases of the JSON schema specification and meta schemas are qualified as _draft_ primarily for historical reasons stemming from the relationship of this specification to IETF. + +The JSON schema project recognizes, condones and advocates for the use of the JSON schema standard in production. + +Each release of the JSON schema is treated as a production release by the JSON schema project. All changes in each new release are made judiciously, with great care and thorough review with careful consideration of how the changes will impact existing users and implementations of the JSON schema specification. + +Similarly to most specifications, the JSON schema specification will continue to evolve, and not all releases will be backwards compatible. The intention, particularly for vocabularies such as validation which have been widely implemented, is to remain as compatible as possible from release to release. However, major changes can still occur given a clear enough need validated with the user community. + +At some point, the draft qualifier will be dropped, and this may indicate that the frequency of releases and amount of changes in each release will decrease, but it won't indicate that no new releases will be made, or that all future releases will be backwards compatible. ## Quickstart From 298eb3d3728a81ca52c53bfb4b1f1ec6e3003755 Mon Sep 17 00:00:00 2001 From: Iwan Aucamp Date: Sat, 3 Jul 2021 21:03:44 +0200 Subject: [PATCH 046/206] Add links to GitHub Discussions --- _includes/footer.html | 1 + index.md | 1 + 2 files changed, 2 insertions(+) diff --git a/_includes/footer.html b/_includes/footer.html index 63643047..6f99d796 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -13,6 +13,7 @@ {% endif %}
  • Discussion: Slack | Google Groups
  • +
  • GitHub Discussions
  • Site edits: GitHub repo for site
  • diff --git a/index.md b/index.md index b4a512cc..cf00329c 100644 --- a/index.md +++ b/index.md @@ -110,6 +110,7 @@ We encourage updating to the latest specification where possible, which is 2020- Questions? Feeling helpful? Get involved on: * [GitHub](http://github.com/json-schema-org/json-schema-spec) +* [GitHub Discussions](https://github.com/json-schema-org/community/discussions) * [Google Groups](https://groups.google.com/forum/#!forum/json-schema) * [Slack](/slack) * [Open Collective](https://opencollective.com/json-schema) From 14e53de8139ab4bd13caba6b5d5e93796f429458 Mon Sep 17 00:00:00 2001 From: Iwan Aucamp Date: Mon, 5 Jul 2021 22:07:53 +0200 Subject: [PATCH 047/206] Update index.md Fix grammar Co-authored-by: Jason Desrosiers --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index c85c7833..c449d2b9 100644 --- a/index.md +++ b/index.md @@ -73,7 +73,7 @@ Releases of the JSON schema specification and meta schemas are qualified as _dra The JSON schema project recognizes, condones and advocates for the use of the JSON schema standard in production. -Each release of the JSON schema is treated as a production release by the JSON schema project. All changes in each new release are made judiciously, with great care and thorough review with careful consideration of how the changes will impact existing users and implementations of the JSON schema specification. +Each release of the JSON schema specification is treated as a production release by the JSON schema project. All changes in each new release are made judiciously, with great care and thorough review with careful consideration of how the changes will impact existing users and implementations of the JSON schema specification. Similarly to most specifications, the JSON schema specification will continue to evolve, and not all releases will be backwards compatible. The intention, particularly for vocabularies such as validation which have been widely implemented, is to remain as compatible as possible from release to release. However, major changes can still occur given a clear enough need validated with the user community. From 24c9a1d930dc877849789c775213e478a6e6668b Mon Sep 17 00:00:00 2001 From: Iwan Aucamp Date: Tue, 6 Jul 2021 01:12:02 +0200 Subject: [PATCH 048/206] Add rationale for continued use of draft designation Also change "qualifier" to "designation", and fix grammar in third paragraph. --- index.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/index.md b/index.md index c449d2b9..b0a7dc0d 100644 --- a/index.md +++ b/index.md @@ -67,17 +67,18 @@ In the meantime, publication of Internet-Draft documents can be tracked through Internet-Drafts expire after six months, so our goal is to publish often enough to always have a set of unexpired drafts available. There may be brief gaps as we wrap up each draft and finalize the text. -### Use of the _draft_ qualifier +### Use of the _draft_ designation -Releases of the JSON schema specification and meta schemas are qualified as _draft_ primarily for historical reasons stemming from the relationship of this specification to IETF. +Releases of the JSON schema specification and meta schemas use the _draft_ designation primarily for historical reasons stemming from the relationship of this specification to IETF ([explained here](https://json-schema.org/specification-links.html#understanding-draft-names-and-numbers)). +The use of this designation is under review but will continue until this review process completes to avoid changing the designation style multiple times. The JSON schema project recognizes, condones and advocates for the use of the JSON schema standard in production. -Each release of the JSON schema specification is treated as a production release by the JSON schema project. All changes in each new release are made judiciously, with great care and thorough review with careful consideration of how the changes will impact existing users and implementations of the JSON schema specification. +Each release of the JSON schema specification is treated as a production release by the JSON schema project. All changes in each new release are made judiciously, with great care, thorough review and careful consideration of how the changes will impact existing users and implementations of the JSON schema specification. Similarly to most specifications, the JSON schema specification will continue to evolve, and not all releases will be backwards compatible. The intention, particularly for vocabularies such as validation which have been widely implemented, is to remain as compatible as possible from release to release. However, major changes can still occur given a clear enough need validated with the user community. -At some point, the draft qualifier will be dropped, and this may indicate that the frequency of releases and amount of changes in each release will decrease, but it won't indicate that no new releases will be made, or that all future releases will be backwards compatible. +When the _draft_ designation is dropped this may indicate that the frequency of releases and amount of changes in each release will decrease, but it won't indicate that no new releases will be made, or that all future releases will be backwards compatible. ## Quickstart From 11d2ab15dd250418be0f0a65054c8252104a689d Mon Sep 17 00:00:00 2001 From: Iwan Aucamp Date: Tue, 6 Jul 2021 18:44:10 +0200 Subject: [PATCH 049/206] Update index.md add oxford comma Co-authored-by: Ben Hutton --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index b0a7dc0d..27d80190 100644 --- a/index.md +++ b/index.md @@ -72,7 +72,7 @@ Internet-Drafts expire after six months, so our goal is to publish often enough Releases of the JSON schema specification and meta schemas use the _draft_ designation primarily for historical reasons stemming from the relationship of this specification to IETF ([explained here](https://json-schema.org/specification-links.html#understanding-draft-names-and-numbers)). The use of this designation is under review but will continue until this review process completes to avoid changing the designation style multiple times. -The JSON schema project recognizes, condones and advocates for the use of the JSON schema standard in production. +The JSON schema project recognizes, condones, and advocates for the use of the JSON schema standard in production. Each release of the JSON schema specification is treated as a production release by the JSON schema project. All changes in each new release are made judiciously, with great care, thorough review and careful consideration of how the changes will impact existing users and implementations of the JSON schema specification. From 5d97d48efe61a4b6e672e7e97461ee9ad5242c5a Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Mon, 2 Aug 2021 22:33:38 -0700 Subject: [PATCH 050/206] update support info for JSON::Schema::Modern, JSON::Schema::Tiny JSON::Schema::Draft201909 has been renamed and now also supports drafts 7 and 2020-12 JSON::Schema::Tiny now also supports 7, 2019-09, 2020-12 --- _data/validator-libraries-modern.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 61b07912..ec275461 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -183,15 +183,15 @@ license: MIT - name: Perl implementations: - - name: JSON::Schema::Draft201909 - url: https://github.com/karenetheridge/JSON-Schema-Draft201909 + - name: JSON::Schema::Modern + url: https://github.com/karenetheridge/JSON-Schema-Modern notes: - date-draft: [2019-09] + date-draft: [7, 2019-09, 2020-12] license: "GNU General Public License, Version 1 + The Artistic License 1.0" - name: JSON::Schema::Tiny url: https://github.com/karenetheridge/JSON-Schema-Tiny notes: - date-draft: [2019-09] + date-draft: [7, 2019-09, 2020-12] license: "GNU General Public License, Version 1 + The Artistic License 1.0" - name: JSON::Validator url: https://github.com/mojolicious/json-validator From 64a4613255db30c1823e96e8579875e5bde90d3e Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Fri, 6 Aug 2021 15:05:25 +0100 Subject: [PATCH 051/206] Added blog --- _includes/header.html | 1 + 1 file changed, 1 insertion(+) diff --git a/_includes/header.html b/_includes/header.html index a744b2a2..3aa58e9b 100644 --- a/_includes/header.html +++ b/_includes/header.html @@ -25,6 +25,7 @@ {{ my_page.title | escape }} {%- endif -%} {% endfor -%} + Blog Join our Slack From fa6396562294496ddd6aa330d2921c9161bc9c07 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Thu, 12 Aug 2021 09:34:55 -0700 Subject: [PATCH 052/206] Release Notes: Unicode not required in RegExp While "SHOULD" is not a strict requirement, it does imply that it should be followed unless you have a really good reason not to. I tried to choose words that made it sound more important than just a recommendation while still making in clear that it's not strictly required. --- draft/2020-12/release-notes.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/draft/2020-12/release-notes.md b/draft/2020-12/release-notes.md index 742a5009..e4fb5c2b 100644 --- a/draft/2020-12/release-notes.md +++ b/draft/2020-12/release-notes.md @@ -288,9 +288,9 @@ considered unevaluated and fails the `unevaluatedItems` keyword like it did in previous drafts. ## Regular Expressions -Regular expressions are now required to support unicode characters. Previously, -this was unspecified and implementations may or may not support this unicode in -regular expressions. +Regular expressions are now expected (but not strictly required) to support +unicode characters. Previously, this was unspecified and implementations may or +may not support this unicode in regular expressions. ## Media Type Changes JSON Schema defines two media types, `application/schema+json` and From 2cacfcf9c098117b02c8bdea128380f147f3f2c8 Mon Sep 17 00:00:00 2001 From: Aleksey Stavrov Date: Mon, 16 Aug 2021 09:57:20 +0500 Subject: [PATCH 053/206] add perl validator JSONSchema::Validator --- _data/validator-libraries-modern.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index ec275461..03581a94 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -199,6 +199,12 @@ date-draft: draft: [7, 6, 4] license: "The Artistic License 2.0 (GPL Compatible)" + - name: JSONSchema::Validator + url: https://github.com/skbkontur/perl-jsonschema-validator + notes: + date-draft: + draft: [7, 6, 4] + license: MIT - name: PHP implementations: - name: Opis Json Schema From 8842f3b27f2f382fbff8c8ff7f1c8edb06574613 Mon Sep 17 00:00:00 2001 From: pinery-systems Date: Sun, 22 Aug 2021 23:27:22 -0400 Subject: [PATCH 054/206] JSON Essentials for COM/ActiveX added to the modern validator list --- _data/validator-libraries-modern.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index ec275461..d19c3ee6 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -55,6 +55,13 @@ date-draft: draft: [7] license: Apache License, Version 2.0 +- name: COM/ActiveX + implementations: + - name: JSON Essentials for COM/ActiveX + url: https://pinery.systems/json-essentials-com/index.html + draft: [7] + license: proprietary + notes: Language independent, includes JSON DOM parser, REST ready, 4 licensing options for free and business uses. For Windows platform only. - name: Common Lisp implementations: - name: json-schema From 6bdfb703e3df0422988deefc8a49c8aaaede471d Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Fri, 3 Sep 2021 00:25:24 +1200 Subject: [PATCH 055/206] add json-everything.net and jsonschema.dev to online validators --- _data/validator-libraries-modern.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index c81c1e6d..1dfb9b11 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -243,13 +243,24 @@ implementations: - name: Hyperjump JSV url: https://json-schema.hyperjump.io - date-draft: [2019-09] + date-draft: [2019-09, 2020-12] draft: [7, 6, 4] notes: Supports multiple schemas and multiple instances + - name: jsonschema.dev + url: https://jsonschema.dev + date-draft: [2019-09, 2020-12] + draft: [7, 6, 4] + notes: Powered by ajv; client-side validation + - name: json-everything + url: https://json-everything.net + date-draft: [2019-09, 2020-12] + draft: [7, 6] + notes: Powered by JsonSchema.Net; server-side validation - name: JSON Schema Validator url: https://www.jsonschemavalidator.net/ date-draft: [2019-09] draft: [7, 6, 4, 3] + notes: Powered by JSON.Net; server-side validation - name: JSON Schema Lint url: http://jsonschemalint.com/ date-draft: From 4823406bfd843a642413cf3edd65c371d4464274 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Fri, 3 Sep 2021 00:42:07 +1200 Subject: [PATCH 056/206] updated with client-/server-side details where known --- _data/validator-libraries-modern.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 1dfb9b11..6127cbe5 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -243,19 +243,19 @@ implementations: - name: Hyperjump JSV url: https://json-schema.hyperjump.io - date-draft: [2019-09, 2020-12] - draft: [7, 6, 4] - notes: Supports multiple schemas and multiple instances - - name: jsonschema.dev - url: https://jsonschema.dev - date-draft: [2019-09, 2020-12] + date-draft: [2020-12, 2019-09] draft: [7, 6, 4] - notes: Powered by ajv; client-side validation + notes: Supports multiple schemas and multiple instances; client-side validation - name: json-everything url: https://json-everything.net - date-draft: [2019-09, 2020-12] + date-draft: [2020-12, 2019-09] draft: [7, 6] notes: Powered by JsonSchema.Net; server-side validation + - name: jsonschema.dev + url: https://jsonschema.dev + date-draft: [2019-09] + draft: [7, 6, 4] + notes: Powered by ajv; client-side validation - name: JSON Schema Validator url: https://www.jsonschemavalidator.net/ date-draft: [2019-09] From d47dfb11340c9cd0146d2222df6287a51e4fafba Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Tekuri Date: Thu, 2 Sep 2021 20:46:51 +0530 Subject: [PATCH 057/206] santhosh-tekuri/jsonschema: 2020-12, 2019-19 support --- _data/validator-libraries-modern.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index ec275461..172e70d1 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -84,10 +84,10 @@ license: "Apache 2.0" - name: santhosh-tekuri/jsonschema url: https://github.com/santhosh-tekuri/jsonschema - notes: - date-draft: + notes: includes custom keywords, output formats + date-draft: [2020-12, 2019-09] draft: [7, 6, 4] - license: BSD-3-Clause + license: Apache License 2.0 - name: qri-io/jsonschema url: https://github.com/qri-io/jsonschema date-draft: [2019-09] From 96a1e236e4e2ceeee4b27b0d496d6204c498d7df Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Fri, 3 Sep 2021 13:08:35 +1200 Subject: [PATCH 058/206] Update _data/validator-libraries-modern.yml Co-authored-by: Jason Desrosiers --- _data/validator-libraries-modern.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 9b24d2c0..d7096029 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -285,8 +285,7 @@ notes: Powered by JsonSchema.Net; server-side validation - name: jsonschema.dev url: https://jsonschema.dev - date-draft: [2019-09] - draft: [7, 6, 4] + draft: [7] notes: Powered by ajv; client-side validation - name: jschon.dev url: https://jschon.dev/ From ce287bae6d3ec63cae281258382872253bf3e965 Mon Sep 17 00:00:00 2001 From: IdrissaD <73114156+IdrissaD@users.noreply.github.com> Date: Fri, 10 Sep 2021 11:48:51 +0200 Subject: [PATCH 059/206] Update drafts jsonschema Python validator --- _data/validator-libraries-modern.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 32b1f8dd..6bb799d7 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -224,7 +224,7 @@ - name: jsonschema url: https://github.com/Julian/jsonschema notes: - date-draft: + date-draft: [2019-09, 2020-12] draft: [7, 6, 4, 3] license: "MIT" - name: fastjsonschema From f5ee27e26faafa83ee99408e5503e66b6283a85e Mon Sep 17 00:00:00 2001 From: Ed Mackey Date: Fri, 24 Sep 2021 11:31:52 -0400 Subject: [PATCH 060/206] Add wetzel to documentation generators Proposed in https://github.com/CesiumGS/wetzel/issues/13#issuecomment-926447549 --- implementations.md | 1 + 1 file changed, 1 insertion(+) diff --git a/implementations.md b/implementations.md index 36f55bf3..61252d21 100644 --- a/implementations.md +++ b/implementations.md @@ -267,6 +267,7 @@ _None currently support draft-06 or later._ - [jsonschematic](https://github.com/yanick/jsonschematic/) - Svelte-based schema viewer. Runs as a local web app. Supports draft-7. - [docson](https://github.com/lbovet/docson) - Javascript-based schema viewer. Runs as a local web app. Supports draft-4. - [json-schema-for-humans](https://pypi.org/project/json-schema-for-humans/) - Generate HTML representation of a schema. Python-based. Supports draft-7. +- [wetzel](https://github.com/CesiumGS/wetzel) - Generates Markdown and AsciiDoc. With some limitations, supports draft-3, draft-4, draft-7, and 2020-12. Schema Repositories ------------------- From 0e7e8eaad51775f56324975b33e08333cefb0fd0 Mon Sep 17 00:00:00 2001 From: Sergey Fedoseev Date: Wed, 6 Oct 2021 18:34:57 +0500 Subject: [PATCH 061/206] Fix typo: vocablary => vocabulary --- specification-links.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specification-links.md b/specification-links.md index c891aed5..c20aa358 100644 --- a/specification-links.md +++ b/specification-links.md @@ -293,7 +293,7 @@ For links to the somewhat more readably formatted versions on this web site, and - Relative JSON Pointer: [draft-bhutton-relative-json-pointer-00](https://tools.ietf.org/html/draft-bhutton-relative-json-pointer-00) ([changes](https://tools.ietf.org/html/draft-bhutton-relative-json-pointer-00#appendix-A)) - General use meta-schemas - [JSON Schema meta-schema](draft/2020-12/schema) -- Individual vocablary meta-schemas +- Individual vocabulary meta-schemas - [Core Vocabulary meta-schema](draft/2020-12/meta/core) - [Applicator Vocabulary meta-schema](draft/2020-12/meta/applicator) - [Validation Vocabulary meta-schema](draft/2020-12/meta/validation) @@ -320,7 +320,7 @@ _**NOTE:** All meta-schema URIs now use `https://`. While currently also availa - [JSON Schema meta-schema](https://json-schema.org/draft/2019-09/schema) - [JSON Hyper-Schema meta-schema](https://json-schema.org/draft/2019-09/hyper-schema) - [JSON Hyper-Schema Link Description Object meta-schema](https://json-schema.org/draft/2019-09/links) -- Individual vocablary meta-schemas +- Individual vocabulary meta-schemas - [Core Vocabulary meta-schema](https://json-schema.org/draft/2019-09/meta/core) - [Applicator Vocabulary meta-schema](https://json-schema.org/draft/2019-09/meta/applicator) - [Validation Vocabulary meta-schema](https://json-schema.org/draft/2019-09/meta/validation) From 231ad3b2201e1b95f7e216021e8fa3417bd4d596 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Thu, 21 Oct 2021 09:30:09 -0700 Subject: [PATCH 062/206] Updates to make hyper-schema fixes/additions available --- .gitmodules | 1 + _includes/draft/2019-09 | 2 +- _includes/draft/2020-12 | 2 +- specification-links.md | 1 + specification.md | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 3ac879c1..ec9c71cd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -26,6 +26,7 @@ [submodule "_includes/draft/2019-09"] path = _includes/draft/2019-09 url = https://github.com/json-schema-org/json-schema-spec.git + branch = 2019-09 [submodule "_includes/draft/2020-12"] path = _includes/draft/2020-12 url = https://github.com/json-schema-org/json-schema-spec.git diff --git a/_includes/draft/2019-09 b/_includes/draft/2019-09 index 03fe369b..f25113a1 160000 --- a/_includes/draft/2019-09 +++ b/_includes/draft/2019-09 @@ -1 +1 @@ -Subproject commit 03fe369b6192bcd6052e96bac8a5b0cfd15d5c07 +Subproject commit f25113a1300b11938541c5c31ff9f908a06861f4 diff --git a/_includes/draft/2020-12 b/_includes/draft/2020-12 index 0e08f035..117c05e5 160000 --- a/_includes/draft/2020-12 +++ b/_includes/draft/2020-12 @@ -1 +1 @@ -Subproject commit 0e08f03573753bebe2841023dd6fcc822490ea07 +Subproject commit 117c05e55ae0a798a10907f61348c81318971f9d diff --git a/specification-links.md b/specification-links.md index c20aa358..c77c896c 100644 --- a/specification-links.md +++ b/specification-links.md @@ -293,6 +293,7 @@ For links to the somewhat more readably formatted versions on this web site, and - Relative JSON Pointer: [draft-bhutton-relative-json-pointer-00](https://tools.ietf.org/html/draft-bhutton-relative-json-pointer-00) ([changes](https://tools.ietf.org/html/draft-bhutton-relative-json-pointer-00#appendix-A)) - General use meta-schemas - [JSON Schema meta-schema](draft/2020-12/schema) + - [JSON Hyper-Schema meta-schema](draft/2020-12/hyper-schema) (2019-09 Hyper-Schema with 2020-12 Validation) - Individual vocabulary meta-schemas - [Core Vocabulary meta-schema](draft/2020-12/meta/core) - [Applicator Vocabulary meta-schema](draft/2020-12/meta/applicator) diff --git a/specification.md b/specification.md index 63f9d73a..ab8e91c2 100644 --- a/specification.md +++ b/specification.md @@ -42,6 +42,7 @@ Please note, additional vocabulary specific schema files are needed to fully con |--------------------------------------------------------------|------------------------------------------------------------| | [Core/Validation Dialect meta-schema](draft/2020-12/schema) | Used for schemas written for pure validation. | +| [Hyper-Schema Dialect meta-schema](draft/2020-12/hyper-schema) | Used for schemas written for validation (2020-12) and hyper-linking (2019-09).| | [Recommended Output meta-schema](draft/2020-12/output/schema)| Recommended output structure of the application process. | ## Single-vocabulary meta-schemas From 5222a67a2ee2f4e9cd763fdae24aeb4b1b4c1525 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Thu, 4 Nov 2021 11:03:59 +0000 Subject: [PATCH 063/206] Migrated content about draft notation inside an expandable details element --- index.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.md b/index.md index 97269dce..ea8d289f 100644 --- a/index.md +++ b/index.md @@ -68,9 +68,10 @@ Internet-Drafts expire after six months, so our goal is to publish often enough ### Use of the _draft_ designation - Releases of the JSON schema specification and meta schemas use the _draft_ designation primarily for historical reasons stemming from the relationship of this specification to IETF ([explained here](https://json-schema.org/specification-links.html#understanding-draft-names-and-numbers)). The use of this designation is under review but will continue until this review process completes to avoid changing the designation style multiple times. +
    +Read more The JSON schema project recognizes, condones, and advocates for the use of the JSON schema standard in production. @@ -79,7 +80,7 @@ Each release of the JSON schema specification is treated as a production release Similarly to most specifications, the JSON schema specification will continue to evolve, and not all releases will be backwards compatible. The intention, particularly for vocabularies such as validation which have been widely implemented, is to remain as compatible as possible from release to release. However, major changes can still occur given a clear enough need validated with the user community. When the _draft_ designation is dropped this may indicate that the frequency of releases and amount of changes in each release will decrease, but it won't indicate that no new releases will be made, or that all future releases will be backwards compatible. - +
    ## Quickstart The JSON document being validated or described we call the *instance*, and the document containing the description is called the *schema*. From ea2ace2f18fee8d1f6401a9990e29381189cbc45 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Thu, 4 Nov 2021 13:42:41 +0000 Subject: [PATCH 064/206] Highlight and link to community discussions, regular calls, and our slack server. Resolves #98 Resolves #99 Resolves #100 --- assets/logo-slack.svg | 1 + assets/main.scss | 53 +++++++++++++++++++++++++++++++++++++++++++ index.md | 44 +++++++++++++++++++++++++++-------- 3 files changed, 89 insertions(+), 9 deletions(-) create mode 100644 assets/logo-slack.svg diff --git a/assets/logo-slack.svg b/assets/logo-slack.svg new file mode 100644 index 00000000..69a4eb6a --- /dev/null +++ b/assets/logo-slack.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/main.scss b/assets/main.scss index 39e9a030..9e965232 100644 --- a/assets/main.scss +++ b/assets/main.scss @@ -124,3 +124,56 @@ $content-width: 960px !default; font-size: 14px; } } + +// Minimal buttons https://github.com/vladocar/Simple-Button +.button { + font-size: 1em; + display: block; + border: 0; + margin: 0 6px; + padding: 0.7em; + cursor: pointer; + text-align: center; + transition-duration: 0.1s; + transition-timing-function: linear; +} +.button:hover, +.button:focus { + opacity: 0.8; +} +.btcolor { + background-color: red; + color: #fff; +} +.btcolor:hover, +.btcolor:focus { + background: #ff6666; + color: #f0f0f0; +} +.round { + border-radius: 0.6em; +} +.pill { + border-radius: 1.1em / 50%; +} +.border { + border: 1px solid #1577ca; +} + +// Other custom CSS + +.button-center { + display: inline-block; +} +.text-center { + text-align: center; +} + +.small-svg-logo { + height: 1.3em; + width: 1.3em; +} + +.wrapper.buttons { + margin-bottom: 10px; +} \ No newline at end of file diff --git a/index.md b/index.md index ea8d289f..5392fa11 100644 --- a/index.md +++ b/index.md @@ -20,21 +20,48 @@ permalink: / -## New to JSON Schema? +## What now? -Learning a new specification can be daunting. +Learn, Get help, Shape the Community, Chat, with the JSON Schema team and Community! -You should read our [getting started guide](/learn/getting-started-step-by-step)! + + +## Regular Activities + +We hold weekly Office Hours and twice monthly Open Community Working Meetings. + + + +Office Hours are every Tuesday at 15:00 UTC. -You can also see our other [learning resources](/learn). +Open Community Working Meetings follow two patterns: +- First Friday of the month at 20:00 UTC. +- Third Friday of the month at 15:00 UTC. -### Got questions? +## Need more? + +We have our other [learning resources](/learn), including the [Understanding JSON Schema documentation](/understanding-json-schema). + +## About Our Community + +We have an active and growing community. All are welcome to be part of our community, help shape it, or simply observe. + +We want keep our community welcoming and inclusive, so please read our [JSON Schema Organizational Code of Conduct](https://github.com/json-schema-org/.github/blob/main/CODE_OF_CONDUCT.md). (This is a combination of the Contributor Covenant and IETF BCP 54.) The JSON Schema team and community are here to help! -At any point, feel free to join our [Slack server](/slack). +At any point, feel free to join our Slack server. [Slack server](/slack). + +Our Slack server has limited history, so we also use [GitHub Discussions](https://github.com/json-schema-org/community/discussions). -We also monitor the `jsonschema` tag on StackOverflow. +We monitor the `jsonschema` tag on StackOverflow. ## Project Status @@ -47,7 +74,6 @@ so we will usually refer to `2020-12` (without the word "draft") on this web sit See the [Specification page](specification.html) for details about naming and numbering. - ### The Path to Standardization The JSON Schema project intends to shepherd all three draft series to either: RFC status, the equivalent within another standards body, and/or join a foundation and establish self publication rules. @@ -107,7 +133,7 @@ This allows the team to focus the little time they do donate on JSON Schema core We may revisit JSON Hyper-Schema at a later date. -## More +## More Links Interested? Check out: From ca9837fdf963a54aff8ab1c887eb8fa83954f852 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Mon, 8 Nov 2021 10:49:38 -0800 Subject: [PATCH 065/206] Add missing symbolic links for serving hyper-schema --- draft/2020-12/hyper-schema | 1 + draft/2020-12/links | 1 + specification-links.md | 1 + 3 files changed, 3 insertions(+) create mode 120000 draft/2020-12/hyper-schema create mode 120000 draft/2020-12/links diff --git a/draft/2020-12/hyper-schema b/draft/2020-12/hyper-schema new file mode 120000 index 00000000..efe89864 --- /dev/null +++ b/draft/2020-12/hyper-schema @@ -0,0 +1 @@ +../../_includes/draft/2020-12/hyper-schema.json \ No newline at end of file diff --git a/draft/2020-12/links b/draft/2020-12/links new file mode 120000 index 00000000..f36c1c0d --- /dev/null +++ b/draft/2020-12/links @@ -0,0 +1 @@ +../../_includes/draft/2020-12/links.json \ No newline at end of file diff --git a/specification-links.md b/specification-links.md index c77c896c..2bf9b018 100644 --- a/specification-links.md +++ b/specification-links.md @@ -294,6 +294,7 @@ For links to the somewhat more readably formatted versions on this web site, and - General use meta-schemas - [JSON Schema meta-schema](draft/2020-12/schema) - [JSON Hyper-Schema meta-schema](draft/2020-12/hyper-schema) (2019-09 Hyper-Schema with 2020-12 Validation) + - [JSON Hyper-Schema Link Description Object meta-schema](draft/2020-12/links) - Individual vocabulary meta-schemas - [Core Vocabulary meta-schema](draft/2020-12/meta/core) - [Applicator Vocabulary meta-schema](draft/2020-12/meta/applicator) From b8146af7a811e1f54c70caeaef1a645f1efa3c01 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Tue, 9 Nov 2021 09:11:21 +0000 Subject: [PATCH 066/206] Undo accidental repetition Co-authored-by: Jason Desrosiers --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index 5392fa11..e065360f 100644 --- a/index.md +++ b/index.md @@ -57,7 +57,7 @@ We want keep our community welcoming and inclusive, so please read our [JSON Sch The JSON Schema team and community are here to help! -At any point, feel free to join our Slack server. [Slack server](/slack). +At any point, feel free to join our [Slack server](/slack). Our Slack server has limited history, so we also use [GitHub Discussions](https://github.com/json-schema-org/community/discussions). From 46e2c5c14ec3b805548e9e701ce89b70ff215187 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Tue, 9 Nov 2021 09:12:22 +0000 Subject: [PATCH 067/206] Correct grammar Co-authored-by: Jason Desrosiers --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index e065360f..7e4087dd 100644 --- a/index.md +++ b/index.md @@ -53,7 +53,7 @@ We have our other [learning resources](/learn), including the [Understanding JSO We have an active and growing community. All are welcome to be part of our community, help shape it, or simply observe. -We want keep our community welcoming and inclusive, so please read our [JSON Schema Organizational Code of Conduct](https://github.com/json-schema-org/.github/blob/main/CODE_OF_CONDUCT.md). (This is a combination of the Contributor Covenant and IETF BCP 54.) +We want to keep our community welcoming and inclusive, so please read our [JSON Schema Organizational Code of Conduct](https://github.com/json-schema-org/.github/blob/main/CODE_OF_CONDUCT.md). (This is a combination of the Contributor Covenant and IETF BCP 54.) The JSON Schema team and community are here to help! From 149ae3c6a2cc11d214035f2d7a43adf17632cf26 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Tue, 9 Nov 2021 11:26:37 -0800 Subject: [PATCH 068/206] Update 2019-09 includes --- _includes/draft/2019-09 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/draft/2019-09 b/_includes/draft/2019-09 index f25113a1..41014ea7 160000 --- a/_includes/draft/2019-09 +++ b/_includes/draft/2019-09 @@ -1 +1 @@ -Subproject commit f25113a1300b11938541c5c31ff9f908a06861f4 +Subproject commit 41014ea723120ce70b314d72f863c6929d9f3cfd From 44dcd53056fb6e5e376ff5bee876fe6eb8571ce4 Mon Sep 17 00:00:00 2001 From: Jonathan Leitschuh Date: Thu, 18 Nov 2021 14:45:20 -0500 Subject: [PATCH 069/206] Add networknt/json-schema-validator to validator-libraries-modern.yml --- _data/validator-libraries-modern.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 7412aa37..03c43399 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -103,6 +103,12 @@ notes: includes custom validator support, rich error returns - name: Java implementations: + - name: networknt/json-schema-validator + url: https://github.com/networknt/json-schema-validator + notes: Uses the Jackson to parse the JSON. Claims to be the fastest JSON Schema Validator. + date-draft: [2019-09] + draft: [4, 6, 7] + license: Apache License, Version 2.0 - name: Snow url: https://github.com/ssilverman/snowy-json notes: Uses Maven for the project and Gson under the hood. From b389a48146c6a5f56637aa4e62d0424fd702b9a8 Mon Sep 17 00:00:00 2001 From: "ben.rubin" Date: Mon, 13 Dec 2021 20:33:07 -0800 Subject: [PATCH 070/206] Change http links to https for links to json-schema.org in documentation --- README.md | 2 +- draft-07/json-hyper-schema-release-notes.md | 2 +- implementations.md | 2 +- index.md | 2 +- learn/file-system.md | 38 ++++++++++----------- learn/getting-started-step-by-step.md | 32 ++++++++--------- learn/miscellaneous-examples.md | 24 ++++++------- obsolete-implementations.md | 10 +++--- 8 files changed, 56 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 2a457cd9..6e874b59 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # JSON Schema Website -This is the repository for the [JSON Schema website](http://json-schema.org). +This is the repository for the [JSON Schema website](https://json-schema.org). For issues, discussion, and changes to the JSON Schema specification, please use the [json-schema-spec](https://github.com/json-schema-org/json-schema-spec) repository. diff --git a/draft-07/json-hyper-schema-release-notes.md b/draft-07/json-hyper-schema-release-notes.md index 2b6ae1ca..8484ca38 100644 --- a/draft-07/json-hyper-schema-release-notes.md +++ b/draft-07/json-hyper-schema-release-notes.md @@ -50,7 +50,7 @@ for information related to draft-05. ### Migrating from draft-04 In the ideal draft-07 world, links and -[operations](http://json-schema.org/draft-07/json-schema-hypermedia.html#rfc.section.3.1) +[operations](https://json-schema.org/draft-07/json-schema-hypermedia.html#rfc.section.3.1) are not the same concept. Using terminology borrowed from [OpenAPI's Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#operationObject), HTTP methods are operations, and each link (as described by a single LDO) can support multiple operations. diff --git a/implementations.md b/implementations.md index 61252d21..23211827 100644 --- a/implementations.md +++ b/implementations.md @@ -272,7 +272,7 @@ _None currently support draft-06 or later._ Schema Repositories ------------------- -- [SchemaStore.org](http://schemastore.org/json/) - validate against common JSON Schemas +- [SchemaStore.org](https://schemastore.org/json/) - validate against common JSON Schemas Schema Linter diff --git a/index.md b/index.md index 7e4087dd..fc42c924 100644 --- a/index.md +++ b/index.md @@ -146,7 +146,7 @@ We encourage updating to the latest specification where possible, which is 2020- Questions? Feeling helpful? Get involved on: -* [GitHub](http://github.com/json-schema-org/json-schema-spec) +* [GitHub](https://github.com/json-schema-org/json-schema-spec) * [GitHub Discussions](https://github.com/json-schema-org/community/discussions) * [Google Groups](https://groups.google.com/forum/#!forum/json-schema) * [Slack](/slack) diff --git a/learn/file-system.md b/learn/file-system.md index 72e32e3a..da7630b9 100644 --- a/learn/file-system.md +++ b/learn/file-system.md @@ -66,16 +66,16 @@ We will start with a base JSON Schema expressing the following constraints: Building out our JSON Schema from top to bottom: -* The [`$id`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.1) keyword. -* The [`$schema`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.1) keyword. -* The [`type`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.1) validation keyword. -* The [`required`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.5.3) validation keyword. -* The [`properties`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.1) validation keyword. +* The [`$id`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.1) keyword. +* The [`$schema`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.1) keyword. +* The [`type`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.1) validation keyword. +* The [`required`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.5.3) validation keyword. +* The [`properties`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.1) validation keyword. * The `/` key is empty now; We will fill it out later. -* The [`patternProperties`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.2) validation keyword. +* The [`patternProperties`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.2) validation keyword. * This matches other property names via a regular expression. Note: it does not match `/`. * The `^(/[^/]+)+$` key is empty now; We will fill it out later. -* The [`additionalProperties`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.3) validation keyword. +* The [`additionalProperties`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.3) validation keyword. * The value here is `false` to constrain object properties to be either `/` or to match the regular expression. > You will notice that the regular expression is explicitly anchored (with `^` and `$`): in JSON Schema, regular expressions (in `patternProperties` and in `pattern`) are not anchored by default. @@ -104,11 +104,11 @@ We saw these keywords in the prior exercise: `$id`, `$schema`, `type`, `required To this we add: -* The [`description`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) annotation keyword. -* The [`oneOf`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.2.1.3) keyword. -* The [`$ref`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.3.1) keyword. +* The [`description`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) annotation keyword. +* The [`oneOf`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.2.1.3) keyword. +* The [`$ref`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.3.1) keyword. * In this case, all references used are local to the schema using a relative fragment URI (`#/...`). -* The [`$defs`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.4) keyword. +* The [`$defs`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.4) keyword. * Including several key names which we will define later. ```json @@ -142,12 +142,12 @@ To this we add: Let's now extend this skeleton to add constraints to some of the properties. -* Our `fstype` key uses the [`enum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.2) validation keyword. +* Our `fstype` key uses the [`enum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.2) validation keyword. * Our `options` key uses the following: * The `type` validation keyword (see above). - * The [`minItems`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.2) validation keyword. - * The [`items`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.1.2) validation keyword. - * The [`uniqueItems`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.3) validation keyword. + * The [`minItems`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.2) validation keyword. + * The [`items`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.1.2) validation keyword. + * The [`uniqueItems`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.3) validation keyword. * Together these say: `options` must be an array, and the items therein must be strings, there must be at least one item, and all items should be unique. * We have a `readonly` key. @@ -198,7 +198,7 @@ With these added constraints, the schema now looks like this: One new keyword is introduced here: -* The [`pattern`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.3.3) validation keyword notes the `device` key must be an absolute path starting with */dev*. +* The [`pattern`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.3.3) validation keyword notes the `device` key must be an absolute path starting with */dev*. ```json { @@ -246,7 +246,7 @@ We do have a new key: `label` and the `pattern` validation keyword states it mus We find another new keyword: -* The [`format`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.7) annotation and assertion keyword. +* The [`format`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.7) annotation and assertion keyword. ```json { @@ -276,8 +276,8 @@ We find another new keyword: Our last definition introduces two new keywords: -* The [`minimum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.4) validation keyword. -* The [`maximum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.2) validation keword. +* The [`minimum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.4) validation keyword. +* The [`maximum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.2) validation keyword. * Together these require the size be between 16 and 512, inclusive. ```json diff --git a/learn/getting-started-step-by-step.md b/learn/getting-started-step-by-step.md index 4a1eae90..5c2e51d5 100644 --- a/learn/getting-started-step-by-step.md +++ b/learn/getting-started-step-by-step.md @@ -13,7 +13,7 @@ title: Getting Started Step-By-Step ## Introduction -The following example is by no means definitive of all the value JSON Schema can provide. For this you will need to go deep into the specification itself -- learn more at [http://json-schema.org/specification.html](http://json-schema.org/specification.html). +The following example is by no means definitive of all the value JSON Schema can provide. For this you will need to go deep into the specification itself -- learn more at [https://json-schema.org/specification.html](https://json-schema.org/specification.html). Let's pretend we're interacting with a JSON based product catalog. This catalog has a product which has: @@ -50,10 +50,10 @@ We start with four properties called **keywords** which are expressed as [JSON]( > Yes. the standard uses a JSON data document to describe data documents, most often that are also JSON data documents but could be in any number of other content types like `text/xml`. -* The [`$schema`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.1) keyword states that this schema is written according to a specific draft of the standard and used for a variety of reasons, primarily version control. -* The [`$id`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.1) keyword defines a URI for the schema, and the base URI that other URI references within the schema are resolved against. -* The [`title`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) and [`description`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) annotation keywords are descriptive only. They do not add constraints to the data being validated. The intent of the schema is stated with these two keywords. -* The [`type`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.1) validation keyword defines the first constraint on our JSON data and in this case it has to be a JSON Object. +* The [`$schema`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.1) keyword states that this schema is written according to a specific draft of the standard and used for a variety of reasons, primarily version control. +* The [`$id`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.1) keyword defines a URI for the schema, and the base URI that other URI references within the schema are resolved against. +* The [`title`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) and [`description`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) annotation keywords are descriptive only. They do not add constraints to the data being validated. The intent of the schema is stated with these two keywords. +* The [`type`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.1) validation keyword defines the first constraint on our JSON data and in this case it has to be a JSON Object. ```json { @@ -67,9 +67,9 @@ We start with four properties called **keywords** which are expressed as [JSON]( We introduce the following pieces of terminology when we start the schema: -* [Schema Keyword](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.1): `$schema` and `$id`. -* [Schema Annotations](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1): `title` and `description`. -* [Validation Keyword](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.1): `type`. +* [Schema Keyword](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.1): `$schema` and `$id`. +* [Schema Annotations](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1): `title` and `description`. +* [Validation Keyword](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.1): `type`. ## Defining the properties @@ -77,10 +77,10 @@ We introduce the following pieces of terminology when we start the schema: In JSON Schema terms, we update our schema to add: -* The [`properties`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.1) validation keyword. +* The [`properties`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.1) validation keyword. * The `productId` key. * `description` schema annotation and `type` validation keyword is noted -- we covered both of these in the previous section. -* The [`required`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.5.3) validation keyword listing `productId`. +* The [`required`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.5.3) validation keyword listing `productId`. ```json @@ -130,8 +130,8 @@ In JSON Schema terms, we update our schema to add: According to the store owner there are no free products. ;) * The `price` key is added with the usual `description` schema annotation and `type` validation keywords covered previously. It is also included in the array of keys defined by the `required` validation keyword. -* We specify the value of `price` must be something other than zero using the [`exclusiveMinimum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.5) validation keyword. - * If we wanted to include zero as a valid price we would have specified the [`minimum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.4) validation keyword. +* We specify the value of `price` must be something other than zero using the [`exclusiveMinimum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.5) validation keyword. + * If we wanted to include zero as a valid price we would have specified the [`minimum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.4) validation keyword. ```json { @@ -172,9 +172,9 @@ Therefore: * The `tags` key is added with the usual annotations and keywords. * This time the `type` validation keyword is `array`. -* We introduce the [`items`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.1.2) validation keyword so we can define what appears in the array. In this case: `string` values via the `type` validation keyword. -* The [`minItems`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.2) validation keyword is used to make sure there is at least one item in the array. -* The [`uniqueItems`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.3) validation keyword notes all of the items in the array must be unique relative to one another. +* We introduce the [`items`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.1.2) validation keyword so we can define what appears in the array. In this case: `string` values via the `type` validation keyword. +* The [`minItems`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.2) validation keyword is used to make sure there is at least one item in the array. +* The [`uniqueItems`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.3) validation keyword notes all of the items in the array must be unique relative to one another. * We did not add this key to the `required` validation keyword array because it is optional. ```json @@ -276,7 +276,7 @@ So far our JSON schema has been wholly self contained. It is very common to shar For this example we introduce a new JSON Schema resource and for both properties therein: * We use the `minimum` validation keyword noted earlier. -* We add the [`maximum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.2) validation keyword. +* We add the [`maximum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.2) validation keyword. * Combined, these give us a range to use in validation. ```json diff --git a/learn/miscellaneous-examples.md b/learn/miscellaneous-examples.md index 754e6f4a..946274fd 100644 --- a/learn/miscellaneous-examples.md +++ b/learn/miscellaneous-examples.md @@ -7,15 +7,15 @@ title: Miscellaneous Examples This example provides a typical minimum you are likely to see in JSON Schema. It contains: -* [`$id`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.1) keyword -* [`$schema`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.1) keyword -* [`title`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) annotation keyword -* [`type`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.1) instance data model -* [`properties`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.1) validation keyword +* [`$id`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.1) keyword +* [`$schema`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.1) keyword +* [`title`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) annotation keyword +* [`type`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.1) instance data model +* [`properties`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.1) validation keyword * Three keys: `firstName`, `lastName` and `age` each with their own: - * [`description`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) annotation keyword. + * [`description`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) annotation keyword. * `type` instance data model (see above). -* [`minimum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.4) validation keyword on the `age` key. +* [`minimum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.4) validation keyword on the `age` key. ```json { @@ -55,9 +55,9 @@ This example provides a typical minimum you are likely to see in JSON Schema. It This example introduces: -* [`required`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.5.3) validation keyword -* [`minimum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.4) validation keyword -* [`maximum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.2) validation keyword +* [`required`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.5.3) validation keyword +* [`minimum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.4) validation keyword +* [`maximum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.2) validation keyword ```json { @@ -100,8 +100,8 @@ Arrays are fundamental structures in JSON -- here we demonstrate a couple of way We also introduce the following with this example: -* [`$defs`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.4) keyword -* [`$ref`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.3.1) keyword +* [`$defs`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.4) keyword +* [`$ref`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.3.1) keyword ```json { diff --git a/obsolete-implementations.md b/obsolete-implementations.md index 86af9e19..e8de25fb 100644 --- a/obsolete-implementations.md +++ b/obsolete-implementations.md @@ -129,7 +129,7 @@ Schema Generators - TypeScript - [Typson](https://github.com/lbovet/typson) (Apache 2.0) - Visual Studio - - [JSON Schema Generator](http://visualstudiogallery.msdn.microsoft.com/b4515ef8-a518-41ca-b48c-bb1fd4e6faf7) - free extension + - [JSON Schema Generator](https://visualstudiogallery.msdn.microsoft.com/b4515ef8-a518-41ca-b48c-bb1fd4e6faf7) - free extension - Sparx Enterprise Architect - [API-Add-In](https://github.com/bayeslife/api-add-in) - Sparx EA extension for exporting JSON Schema from UML models @@ -167,9 +167,9 @@ Various levels of support for UI generation primarily from the validation vocabu - JavaScript - [JSON Editor](https://github.com/jdorn/json-editor) (MIT) - - [JSONForms](http://jsonforms.io) (EclipseSource) (MIT) - - [Jsonary](http://jsonary.com/) (MIT) - - [Metawidget](http://metawidget.org/) (LGPL) + - [JSONForms](https://jsonforms.io) (EclipseSource) (MIT) + - [Jsonary](https://jsonary.com/) (MIT) + - [Metawidget](https://metawidget.org/) (LGPL) - [pure-form webcomponent](https://github.com/john-doherty/pure-form) (MIT) Editors @@ -201,5 +201,5 @@ Other ----- - JavaScript - - [Dojo](http://www.dojotoolkit.org/) (AFL or BSD) - supports some aspects of JSON Schema + - [Dojo](https://www.dojotoolkit.org/) (AFL or BSD) - supports some aspects of JSON Schema - [JSON Schema Random](https://github.com/andreineculau/json-schema-random) (Apache 2.0) From 49bdef94d7c56c8bb9391c5cef2f136f3d761544 Mon Sep 17 00:00:00 2001 From: Jamie Tanna Date: Thu, 16 Dec 2021 08:42:43 +0000 Subject: [PATCH 071/206] Clarify license for the wework library As it's present in the `package.json`. --- implementations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implementations.md b/implementations.md index 23211827..0a803e94 100644 --- a/implementations.md +++ b/implementations.md @@ -235,7 +235,7 @@ _None currently support draft-06 or later._ #### Format converters - OpenAPI - - [JSON Schema to OpenAPI Schema](https://github.com/wework/json-schema-to-openapi-schema) _draft-04_ Draft-06 and -07 planned per README (_license not stated_) + - [JSON Schema to OpenAPI Schema](https://github.com/wework/json-schema-to-openapi-schema) _draft-04_ Draft-06 and -07 planned per README (MIT) - Orderly - [Orderly](https://github.com/lloyd/orderly) (BSD-3-Clause) - RAML From 22c6137f23bb17a24209aaf738dae5f092ab8a21 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Thu, 16 Dec 2021 11:27:07 +0000 Subject: [PATCH 072/206] Updated draft support for existing listing of networknt lib --- _data/validator-libraries-modern.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 03c43399..f5ef02a0 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -103,12 +103,6 @@ notes: includes custom validator support, rich error returns - name: Java implementations: - - name: networknt/json-schema-validator - url: https://github.com/networknt/json-schema-validator - notes: Uses the Jackson to parse the JSON. Claims to be the fastest JSON Schema Validator. - date-draft: [2019-09] - draft: [4, 6, 7] - license: Apache License, Version 2.0 - name: Snow url: https://github.com/ssilverman/snowy-json notes: Uses Maven for the project and Gson under the hood. @@ -137,7 +131,7 @@ - name: networknt/json-schema-validator url: https://github.com/networknt/json-schema-validator notes: Support OpenAPI 3.0 with Jackson parser - date-draft: + date-draft: [2019-09] draft: [7, 6, 4] license: Apache License 2.0 - name: jsonschemafriend From d6408d5bad9e9deb89bbfb2a6d20e0186b8b2e7d Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Mon, 20 Dec 2021 21:32:36 +0000 Subject: [PATCH 073/206] Added org badges --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 6e874b59..b1992750 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # JSON Schema Website +[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://github.com/json-schema-org/.github/blob/main/CODE_OF_CONDUCT.md) +[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) +[![Financial Contributors on Open Collective](https://opencollective.com/json-schema/all/badge.svg?label=financial+contributors)](https://opencollective.com/json-schema) + This is the repository for the [JSON Schema website](https://json-schema.org). For issues, discussion, and changes to the JSON Schema specification, please use the [json-schema-spec](https://github.com/json-schema-org/json-schema-spec) repository. From 5573078007d084310a4e1ad1777dc550b44e46db Mon Sep 17 00:00:00 2001 From: Pascal Desmarets Date: Tue, 21 Dec 2021 15:00:18 +0100 Subject: [PATCH 074/206] Added Hackolade Studio JSON Schema editor Added Hackolade Studio to the list of Editors, since it supports all recent specifications of JSON Schema. See https://hackolade.com/help/JSONSchemaEditor.html for more information --- implementations.md | 1 + 1 file changed, 1 insertion(+) diff --git a/implementations.md b/implementations.md index 0a803e94..a3a2acf5 100644 --- a/implementations.md +++ b/implementations.md @@ -253,6 +253,7 @@ _None currently support draft-06 or later._ - [Altova XMLSpy 2019r3](https://www.altova.com/xmlspy-xml-editor#json_schema) - *Graphical JSON Schema editor for draft-06 and draft-7, as well as validation of JSON files based on JSON Schema* - [Dashjoin JSON Schema editor](https://dashjoin.github.io/#/schema) - *Graphical online JSON Schema editor for draft-06 (minus oneOf, anyOf, allOf, not). The generated schema can be tested immediately via a form that is driven by it.* +- [Hackolade Studio](https://hackolade.com/help/JSONSchemaEditor.html) - *Visual JSON Schema editor for draft-04, draft-06, draft-07, 2019-09, 2020-12, as well as data modeling tool for NoSQL databases, storage formats, REST APIs, and JSON in RDBMS. Also converts to and from: different draft specifications, DDL, XSD, Swagger, OpenAPI, YAML, Avro, Parquet, Protobuf, and most of the NoSQL script syntaxes. Includes a GUI for Entity-Relationship Diagrams and a Command-Line Interface.* - [JSONBuddy](https://www.json-buddy.com/) - *Text and grid-style JSON editor and validator with JSON schema analyzer, context sensitive entry-helpers and sample data generation based on JSON schema. Support for draft-4, draft-6, draft-7 and 2019-09.* - [JSONEditor Online](https://jsoneditoronline.org/) - *View, edit, format, and validate JSON online* Support draft-4, draft-6, and draft-7. - [Liquid JSON Schema Editor](https://www.liquid-technologies.com/json-schema-editor) - *Graphical JSON Schema editor for draft-04, draft-06, draft-07 and 2019-09, with split source code and grphical editing. Includes validation of JSON files based on JSON Schema, JSON Sample Generator and JSON Schema Documentation Generator.* From ab5ef9d233dc8ba6d531fa43e53e015d38eb0506 Mon Sep 17 00:00:00 2001 From: Ethan Date: Thu, 27 Jan 2022 15:18:31 -0800 Subject: [PATCH 075/206] add validation library JSI for ruby --- _data/validator-libraries-modern.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index f5ef02a0..d3e8bbaa 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -260,6 +260,12 @@ date-draft: draft: [7, 6, 4] license: MIT + - name: JSI + url: https://rubydoc.info/gems/jsi + notes: + date-draft: + draft: [7, 6, 4] + license: AGPL-3.0 - name: Rust implementations: - name: jsonschema-rs From 9e8bb227e518f7864bf59bd894d2f33f78728320 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Fri, 18 Feb 2022 10:57:03 +0000 Subject: [PATCH 076/206] Update OCWM call times Both calls each month are now 12:00 PT --- index.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.md b/index.md index fc42c924..e41723d8 100644 --- a/index.md +++ b/index.md @@ -41,9 +41,8 @@ We hold weekly Office Hours and twice monthly Open Community Working Meetings. Office Hours are every Tuesday at 15:00 UTC. -Open Community Working Meetings follow two patterns: -- First Friday of the month at 20:00 UTC. -- Third Friday of the month at 15:00 UTC. +Open Community Working Meetings are every First and Third Friday of the month at 12:00 PT. + ## Need more? From a3a1442bd60aa8d44db0420da1a447e791ba2aae Mon Sep 17 00:00:00 2001 From: Norbert Schultz Date: Fri, 11 Mar 2022 10:31:24 +0100 Subject: [PATCH 077/206] Add rc-circe-json-validator --- _data/validator-libraries-modern.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index d3e8bbaa..17f9a7e8 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -274,6 +274,14 @@ date-draft: draft: [7, 6, 4] license: MIT +- name: Scala + implementations: + - name: Reactive Core Circe JSON Validator + url: https://github.com/reactivecore/rc-circe-json-schema + notes: Based on Circe-Library + date-draft: [2020-12] + draft: + license: Apache License, Version 2.0 - name: Objective-C implementations: - name: DSJSONSchemaValidation From 56f770e0a3b7598093e86f83d23c3e01cb9085f4 Mon Sep 17 00:00:00 2001 From: Sam Lown Date: Tue, 15 Mar 2022 23:09:50 +0000 Subject: [PATCH 078/206] Add Go invopop/jsonschema schema generator link --- implementations.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/implementations.md b/implementations.md index a3a2acf5..87078a6f 100644 --- a/implementations.md +++ b/implementations.md @@ -111,6 +111,8 @@ For example, the only incompatibilities between draft-04 and draft-06 involve `e - .NET - [Json.NET](https://www.newtonsoft.com/jsonschema) (AGPL-3.0) - generates schemas from .NET types - [NJsonSchema](https://github.com/RSuter/NJsonSchema/) - (Ms-PL) - generates schemas from .NET types, see issue [574](https://github.com/RSuter/NJsonSchema/issues/574) for draft-06+ support progress +- Go + - [jsonschema](https://github.com/invopop/jsonschema) - (MIT) - generate schemas from Go structs. Supports Draft 2020-12. - PHP - [Liform](https://github.com/Limenius/liform) (MIT) - generates schemas from Symfony forms - TypeScript From 965844604741c0d3b0309c38d3039687b9ee82df Mon Sep 17 00:00:00 2001 From: Norbert Schultz Date: Fri, 18 Mar 2022 10:08:16 +0100 Subject: [PATCH 079/206] Add 2019-09 --- _data/validator-libraries-modern.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 17f9a7e8..ccf6cdce 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -279,7 +279,7 @@ - name: Reactive Core Circe JSON Validator url: https://github.com/reactivecore/rc-circe-json-schema notes: Based on Circe-Library - date-draft: [2020-12] + date-draft: [2020-12, 2019-09] draft: license: Apache License, Version 2.0 - name: Objective-C From 4217fee03315cbfcf59eb900fe4e6ff55fe64aa4 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Fri, 25 Mar 2022 10:40:09 +0000 Subject: [PATCH 080/206] Update slack invite link --- slack.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slack.md b/slack.md index dd736185..18113d47 100644 --- a/slack.md +++ b/slack.md @@ -1,3 +1,3 @@ --- -redirect_to: https://join.slack.com/t/json-schema/shared_invite/zt-nv0vbdfq-Ba_zz2cZBe_26ZoU7fEYGg +redirect_to: https://join.slack.com/t/json-schema/shared_invite/zt-15ylccbuu-3T2bRia8uzhE157TSW6nXg --- From 82ab1cd0ea690c1c592e06cf61dc2720b805cc69 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Thu, 21 Apr 2022 11:10:33 +0100 Subject: [PATCH 081/206] Clarify implementation state --- _data/validator-libraries-modern.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index ccf6cdce..dd24f022 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -278,7 +278,7 @@ implementations: - name: Reactive Core Circe JSON Validator url: https://github.com/reactivecore/rc-circe-json-schema - notes: Based on Circe-Library + notes: Based on Circe-Library -Early state and API may not be stable. Not yet produciton ready. date-draft: [2020-12, 2019-09] draft: license: Apache License, Version 2.0 From 62045b05ce3831496c0075b0bbb368a408988676 Mon Sep 17 00:00:00 2001 From: Sascha Goldhofer Date: Sat, 23 Apr 2022 20:17:26 +0200 Subject: [PATCH 082/206] add: json-schema-library to list of utilities --- implementations.md | 1 + 1 file changed, 1 insertion(+) diff --git a/implementations.md b/implementations.md index 87078a6f..4f6d3316 100644 --- a/implementations.md +++ b/implementations.md @@ -216,6 +216,7 @@ the utility, and decided on a case-by-case basis. - JavaScript - [json-schema-ref-parser](https://github.com/BigstickCarpet/json-schema-ref-parser) (MIT) Tools for dereferencing non-cyclic schemas, bundling referenced schemas into a single file, and other `$ref` processing. + - [json-schema-library](https://github.com/sagold/json-schema-library) (MIT) - Exposes tools to work with json-schema, including: data creation from json-schema, `$ref` processing, walk through schemas, etc. - [@cloudflare/json-schema-walker](https://github.com/cloudflare/json-schema-tools/tree/master/workspaces/json-schema-walker) ([JSON Schema Tools](https://github.com/cloudflare/json-schema-tools)), _draft-07, -06, -04, and Cloudflare's Doca extensions_ Walks schemas and runs pre- and post-walk callbacks. Can modify schemas in place. (BSD-3-Clause) - [@hyperjump/json-schema-core](https://github.com/jdesrosiers/json-schema-core) (MIT) Tools for working with schemas that handle identifiers and From 1ad3d13c0cd361104879ae9a7067acc1092e8998 Mon Sep 17 00:00:00 2001 From: Sascha Goldhofer Date: Sat, 23 Apr 2022 20:17:53 +0200 Subject: [PATCH 083/206] add: json-schema-library to list of validators --- _data/validator-libraries-modern.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index dd24f022..75b7ce46 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -177,6 +177,12 @@ date-draft: [2019-09, 2020-12] draft: [7, 6, 4] license: MIT + - name: JSON Schema Library + url: https://github.com/sagold/json-schema-library + notes: "Built for Node.js and browsers. Customizable json-validator and json-schema utilities for traversal, data generation and validation" + date-draft: + draft: [7, 6, 4] + license: MIT - name: vue-vuelidate-jsonschema url: https://github.com/mokkabonna/vue-vuelidate-jsonschema date-draft: From 3c826ed40561ddf689ffd4163cd4f5190f7fdd2d Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Wed, 27 Apr 2022 18:35:31 +1200 Subject: [PATCH 084/206] add json-everything as a generator --- implementations.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/implementations.md b/implementations.md index 87078a6f..5ff600c7 100644 --- a/implementations.md +++ b/implementations.md @@ -111,6 +111,7 @@ For example, the only incompatibilities between draft-04 and draft-06 involve `e - .NET - [Json.NET](https://www.newtonsoft.com/jsonschema) (AGPL-3.0) - generates schemas from .NET types - [NJsonSchema](https://github.com/RSuter/NJsonSchema/) - (Ms-PL) - generates schemas from .NET types, see issue [574](https://github.com/RSuter/NJsonSchema/issues/574) for draft-06+ support progress + - [JsonSchema.Net.Generation](https://github.com/gregsdennis/json-everything) (MIT) - generates schemas from .NET types - Go - [jsonschema](https://github.com/invopop/jsonschema) - (MIT) - generate schemas from Go structs. Supports Draft 2020-12. - PHP @@ -201,6 +202,8 @@ Various levels of support for UI generation primarily from the validation vocabu #### Data from schemas +- .Net + - [JsonSchema.Net.DataGeneration](https://github.com/gregsdennis/json-everything) (MIT) Data generation from JSON schemas, powered by the Bogus testing data generation library. - Python - [hypothesis-jsonschema](https://github.com/Zac-HD/hypothesis-jsonschema) (MPL) *draft-07, -06, -04*; takes any schema, even with complex and interacting constraints, and returns a [Hypothesis](https://hypothesis.works/) strategy which can generate valid documents for testing. - Java From aeb9df3124b69ad77358a95dcfd39f6f4a06bd89 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Fri, 29 Apr 2022 09:19:49 +0100 Subject: [PATCH 085/206] Add 2020-12 patch release RC-0 preview Update work in progress page to reflect current state --- draft/preview/jsonschema-core.html | 5802 ++++++++++++++++++++++ draft/preview/jsonschema-validation.html | 3173 ++++++++++++ work-in-progress/index.md | 40 +- 3 files changed, 9014 insertions(+), 1 deletion(-) create mode 100644 draft/preview/jsonschema-core.html create mode 100644 draft/preview/jsonschema-validation.html diff --git a/draft/preview/jsonschema-core.html b/draft/preview/jsonschema-core.html new file mode 100644 index 00000000..b8a7b2e9 --- /dev/null +++ b/draft/preview/jsonschema-core.html @@ -0,0 +1,5802 @@ + + + + + + +JSON Schema: A Media Type for Describing JSON Documents + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Internet-DraftJSON SchemaApril 2022
    Wright, et al.Expires 30 October 2022[Page]
    +
    +
    +
    +
    Workgroup:
    +
    Internet Engineering Task Force
    +
    Internet-Draft:
    +
    draft-bhutton-json-schema-01
    +
    Published:
    +
    + +
    +
    Intended Status:
    +
    Informational
    +
    Expires:
    +
    +
    Authors:
    +
    +
    +
    A. Wright, Ed. +
    +
    +
    +
    H. Andrews, Ed. +
    +
    +
    +
    B. Hutton, Ed. +
    +
    +
    +
    G. Dennis
    +
    +
    +
    +
    +

    JSON Schema: A Media Type for Describing JSON Documents

    +
    +

    Abstract

    +

    + JSON Schema defines the media type "application/schema+json", a JSON-based format + for describing the structure of JSON data. + JSON Schema asserts what a JSON document must look like, + ways to extract information from it, + and how to interact with it. + The "application/schema-instance+json" media type provides additional + feature-rich integration with "application/schema+json" beyond what can be offered + for "application/json" documents.

    +
    +
    +

    +Note to Readers +

    +

    + The issues list for this draft can be found at + https://github.com/json-schema-org/json-schema-spec/issues.

    +

    + For additional information, see https://json-schema.org/.

    +

    + To provide feedback, use this issue tracker, the communication methods listed on the + homepage, or email the document editors.

    +
    +
    +
    +

    +Status of This Memo +

    +

    + This Internet-Draft is submitted in full conformance with the + provisions of BCP 78 and BCP 79.

    +

    + Internet-Drafts are working documents of the Internet Engineering Task + Force (IETF). Note that other groups may also distribute working + documents as Internet-Drafts. The list of current Internet-Drafts is + at https://datatracker.ietf.org/drafts/current/.

    +

    + Internet-Drafts are draft documents valid for a maximum of six months + and may be updated, replaced, or obsoleted by other documents at any + time. It is inappropriate to use Internet-Drafts as reference + material or to cite them other than as "work in progress."

    +

    + This Internet-Draft will expire on 30 October 2022.

    +
    +
    + +
    +
    +

    +Table of Contents +

    + +
    +
    +
    +

    +1. Introduction +

    +

    + JSON Schema is a JSON media type for defining the structure of JSON data. JSON Schema + is intended to define validation, documentation, hyperlink navigation, and interaction + control of JSON data.

    +

    + This specification defines JSON Schema core terminology and mechanisms, including + pointing to another JSON Schema by reference, + dereferencing a JSON Schema reference, + specifying the dialect being used, + specifying a dialect's vocabulary requirements, + and defining the expected output.

    +

    + Other specifications define the vocabularies that perform assertions about validation, + linking, annotation, navigation, and interaction.

    +
    +
    +

    +2. Conventions and Terminology +

    +

    + + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", + "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be + interpreted as described in RFC 2119 [RFC2119].

    +

    + The terms "JSON", "JSON text", "JSON value", "member", "element", "object", "array", + "number", "string", "boolean", "true", "false", and "null" in this document are to + be interpreted as defined in RFC 8259 [RFC8259].

    +
    +
    +

    +3. Overview +

    +

    + This document proposes a new media type "application/schema+json" to identify a JSON + Schema for describing JSON data. + It also proposes a further optional media type, "application/schema-instance+json", + to provide additional integration features. + JSON Schemas are themselves JSON documents. + This, and related specifications, define keywords allowing authors to describe JSON + data in several ways.

    +

    + JSON Schema uses keywords to assert constraints on JSON instances or annotate those + instances with additional information. Additional keywords are used to apply + assertions and annotations to more complex JSON data structures, or based on + some sort of condition.

    +

    + To facilitate re-use, keywords can be organized into vocabularies. A vocabulary + consists of a list of keywords, together with their syntax and semantics. + A dialect is defined as a set of vocabularies and their required support + identified in a meta-schema.

    +

    + JSON Schema can be extended either by defining additional vocabularies, + or less formally by defining additional keywords outside of any vocabulary. + Unrecognized individual keywords simply have their values collected as annotations, + while the behavior with respect to an unrecognized vocabulary can be controlled + when declaring which vocabularies are in use.

    +

    + This document defines a core vocabulary that MUST be supported by any + implementation, and cannot be disabled. Its keywords are each prefixed + with a "$" character to emphasize their required nature. This vocabulary + is essential to the functioning of the "application/schema+json" media + type, and is used to bootstrap the loading of other vocabularies.

    +

    + Additionally, this document defines a RECOMMENDED vocabulary of keywords + for applying subschemas conditionally, and for applying subschemas to + the contents of objects and arrays. Either this vocabulary or one very + much like it is required to write schemas for non-trivial JSON instances, + whether those schemas are intended for assertion validation, annotation, + or both. While not part of the required core vocabulary, for maximum + interoperability this additional vocabulary is included in this document + and its use is strongly encouraged.

    +

    + Further vocabularies for purposes such as structural validation or + hypermedia annotation are defined in other documents. These other + documents each define a dialect collecting the standard sets of + vocabularies needed to write schemas for that document's purpose.

    +
    +
    +

    +4. Definitions +

    +
    +

    +4.1. JSON Document +

    +

    + A JSON document is an information resource (series of octets) described by the + application/json media type.

    +

    + In JSON Schema, the terms "JSON document", "JSON text", and "JSON value" are + interchangeable because of the data model it defines.

    +

    + JSON Schema is only defined over JSON documents. However, any document or memory + structure that can be parsed into or processed according to the JSON Schema data + model can be interpreted against a JSON Schema, including media types like + CBOR [RFC7049].

    +
    +
    +

    +4.2. Instance +

    +

    + A JSON document to which a schema is applied is known as an "instance".

    +

    + JSON Schema is defined over "application/json" or compatible documents, + including media types with the "+json" structured syntax suffix.

    +

    + Among these, this specification defines the "application/schema-instance+json" + media type which defines handling for fragments in the URI.

    +
    +

    +4.2.1. Instance Data Model +

    +

    + JSON Schema interprets documents according to a data model. A JSON value + interpreted according to this data model is called an "instance".

    +

    + An instance has one of six primitive types, and a range of possible values + depending on the type:

    +
    +
    null:
    +
    A JSON "null" value +
    +
    +
    boolean:
    +
    A "true" or "false" value, from the JSON "true" or "false" value +
    +
    +
    object:
    +
    An unordered set of properties mapping a string to an instance, from the JSON "object" value +
    +
    +
    array:
    +
    An ordered list of instances, from the JSON "array" value +
    +
    +
    number:
    +
    An arbitrary-precision, base-10 decimal number value, from the JSON "number" value +
    +
    +
    string:
    +
    A string of Unicode code points, from the JSON "string" value +
    +
    +
    +

    + Whitespace and formatting concerns, including different lexical + representations of numbers that are equal within the data model, are thus + outside the scope of JSON Schema. JSON Schema + vocabularies (Section 8.1) that wish + to work with such differences in lexical representations SHOULD define + keywords to precisely interpret formatted strings within the data model + rather than relying on having the original JSON representation Unicode + characters available.

    +

    + Since an object cannot have two properties with the same key, behavior for a + JSON document that tries to define two properties with + the same key in a single object is undefined.

    +

    + Note that JSON Schema vocabularies are free to define their own extended + type system. This should not be confused with the core data model types + defined here. As an example, "integer" is a reasonable type for a + vocabulary to define as a value for a keyword, but the data model + makes no distinction between integers and other numbers.

    +
    +
    +

    +4.2.2. Instance Equality +

    +

    + Two JSON instances are said to be equal if and only if they are of the same type + and have the same value according to the data model. Specifically, this means:

    +
      +
    • both are null; or +
    • +
    • both are true; or +
    • +
    • both are false; or +
    • +
    • both are strings, and are the same codepoint-for-codepoint; or +
    • +
    • both are numbers, and have the same mathematical value; or +
    • +
    • both are arrays, and have an equal value item-for-item; or +
    • +
    • both are objects, and each property in one has exactly one property with + a key equal to the other's, and that other property has an equal + value. +
    • +
    +

    + Implied in this definition is that arrays must be the same length, + objects must have the same number of members, + properties in objects are unordered, + there is no way to define multiple properties with the same key, + and mere formatting differences (indentation, placement of commas, trailing + zeros) are insignificant.

    +
    +
    +

    +4.2.3. Non-JSON Instances +

    +

    + It is possible to use JSON Schema with a superset of the JSON Schema data model, + where an instance may be outside any of the six JSON data types.

    +

    + In this case, annotations still apply; but most validation keywords will not be useful, + as they will always pass or always fail.

    +

    + A custom vocabulary may define support for a superset of the core data model. + The schema itself may only be expressible in this superset; + for example, to make use of the "const" keyword.

    +
    +
    +
    +
    +

    +4.3. JSON Schema Documents +

    +

    + A JSON Schema document, or simply a schema, is a JSON document used to describe + an instance. + A schema can itself be interpreted as an instance, but SHOULD always be given + the media type "application/schema+json" rather than + "application/schema-instance+json". The "application/schema+json" media + type is defined to offer a superset of the + fragment identifier syntax and semantics provided by + "application/schema-instance+json".

    +

    + A JSON Schema MUST be an object or a boolean.

    +
    +

    +4.3.1. JSON Schema Objects and Keywords +

    +

    + Object properties that are applied to the instance are called keywords, + or schema keywords. Broadly speaking, keywords fall into one + of five categories:

    +
    +
    identifiers:
    +
    + control schema identification through setting a URI + for the schema and/or changing how the base URI is determined +
    +
    +
    assertions:
    +
    + produce a boolean result when applied to an instance +
    +
    +
    annotations:
    +
    + attach information to an instance for application use +
    +
    +
    applicators:
    +
    + apply one or more subschemas to a particular location + in the instance, and combine or modify their results +
    +
    +
    reserved locations:
    +
    + do not directly affect results, but reserve a place + for a specific purpose to ensure interoperability +
    +
    +
    +

    + Keywords may fall into multiple categories, although applicators + SHOULD only produce assertion results based on their subschemas' + results. They should not define additional constraints independent + of their subschemas.

    +

    + Keywords which are properties within the same schema object are referred to as adjacent keywords.

    +

    + Extension keywords, meaning those defined outside of this document + and its companions, are free to define other behaviors as well.

    +

    + A JSON Schema MAY contain properties which are not schema keywords. + Unknown keywords SHOULD be treated as annotations, where the value + of the keyword is the value of the annotation.

    +

    + An empty schema is a JSON Schema with no properties, or only unknown + properties.

    +
    +
    +

    +4.3.2. Boolean JSON Schemas +

    +

    + The boolean schema values "true" and "false" are trivial schemas that + always produce themselves as assertion results, regardless of the + instance value. They never produce annotation results.

    +

    + These boolean schemas exist to clarify schema author intent and + facilitate schema processing optimizations. They behave identically + to the following schema objects (where "not" is part of the + subschema application vocabulary defined in this document).

    +
    +
    true:
    +
    + Always passes validation, as if the empty schema {} +
    +
    +
    false:
    +
    + Always fails validation, as if the schema { "not": {} } +
    +
    +
    +

    + While the empty schema object is unambiguous, there are many + possible equivalents to the "false" schema. Using the boolean + values ensures that the intent is clear to both human readers + and implementations.

    +
    +
    +

    +4.3.3. Schema Vocabularies +

    +

    + A schema vocabulary, or simply a vocabulary, is a set of keywords, + their syntax, and their semantics. A vocabulary is generally organized + around a particular purpose. Different uses of JSON Schema, such + as validation, hypermedia, or user interface generation, will + involve different sets of vocabularies.

    +

    + Vocabularies are the primary unit of re-use in JSON Schema, as schema + authors can indicate what vocabularies are required or optional in + order to process the schema. Since vocabularies are identified by URIs + in the meta-schema, generic implementations can load extensions to support + previously unknown vocabularies. While keywords can be supported outside + of any vocabulary, there is no analogous mechanism to indicate individual + keyword usage.

    +

    + A schema vocabulary can be defined by anything from an informal description + to a standards proposal, depending on the audience and interoperability + expectations. In particular, in order to facilitate vocabulary use within + non-public organizations, a vocabulary specification need not be published + outside of its scope of use.

    +
    +
    +

    +4.3.4. Meta-Schemas +

    +

    + A schema that itself describes a schema is called a meta-schema. + Meta-schemas are used to validate JSON Schemas and specify which vocabularies + they are using.

    +

    + Typically, a meta-schema will specify a set of vocabularies, and validate + schemas that conform to the syntax of those vocabularies. However, meta-schemas + and vocabularies are separate in order to allow meta-schemas to validate + schema conformance more strictly or more loosely than the vocabularies' + specifications call for. Meta-schemas may also describe and validate + additional keywords that are not part of a formal vocabulary.

    +
    +
    +
    +

    +4.3.5. Root Schema and Subschemas and Resources +

    +

    + A JSON Schema resource is a schema which is + canonically [RFC6596] identified by an + absolute URI [RFC3986]. Schema resources MAY + also be identified by URIs, including URIs with fragments, + if the resulting secondary resource (as defined by + section 3.5 of RFC 3986 [RFC3986]) is identical + to the primary resource. This can occur with the empty fragment, + or when one schema resource is embedded in another. Any such URIs + with fragments are considered to be non-canonical.

    +

    + The root schema is the schema that comprises the entire JSON document + in question. The root schema is always a schema resource, where the + URI is determined as described in section + 9.1.1. + + Note that documents that embed schemas in another format will not + have a root schema resource in this sense. Exactly how such usages + fit with the JSON Schema document and resource concepts will be + clarified in a future draft. +

    +

    + Some keywords take schemas themselves, allowing JSON Schemas to be nested:

    +
    +
    +
    +{
    +    "title": "root",
    +    "items": {
    +        "title": "array item"
    +    }
    +}
    +
    +
    +
    +

    + In this example document, the schema titled "array item" is a subschema, + and the schema titled "root" is the root schema.

    +

    + As with the root schema, a subschema is either an object or a boolean.

    +

    + As discussed in section + 8.2.1, a JSON Schema document + can contain multiple JSON Schema resources. When used without qualification, + the term "root schema" refers to the document's root schema. In some + cases, resource root schemas are discussed. A resource's root schema + is its top-level schema object, which would also be a document root schema + if the resource were to be extracted to a standalone JSON Schema document.

    +

    + Whether multiple schema resources are embedded or linked with a reference, + they are processed in the same way, with the same available behaviors.

    +
    +
    +
    +
    +
    +
    +
    +

    +5. Fragment Identifiers +

    +

    + In accordance with section 3.1 of RFC 6839 [RFC6839], + the syntax and semantics of fragment identifiers specified for + any +json media type SHOULD be as specified for "application/json". + (At publication of this document, there is no fragment identification + syntax defined for "application/json".)

    +

    + Additionally, the "application/schema+json" media type supports two + fragment identifier structures: plain names and JSON Pointers. + The "application/schema-instance+json" media type supports one + fragment identifier structure: JSON Pointers.

    +

    + The use of JSON Pointers as URI fragment identifiers is described in + RFC 6901 [RFC6901]. + For "application/schema+json", which supports two fragment identifier syntaxes, + fragment identifiers matching the JSON Pointer syntax, including the empty string, + MUST be interpreted as JSON Pointer fragment identifiers.

    +

    + Per the W3C's + best practices for fragment identifiers [W3C.WD-fragid-best-practices-20121025], + plain name fragment identifiers in "application/schema+json" are reserved for referencing + locally named schemas. All fragment identifiers that do + not match the JSON Pointer syntax MUST be interpreted as + plain name fragment identifiers.

    +

    + Defining and referencing a plain name fragment identifier within an + "application/schema+json" document are specified + in the "$anchor" keyword (Section 8.2.2) section.

    +

    +
    +
    +
    +

    +6. General Considerations +

    +
    +

    +6.1. Range of JSON Values +

    +

    + An instance may be any valid JSON value as defined by JSON [RFC8259]. + JSON Schema imposes no restrictions on type: JSON Schema can describe any JSON + value, including, for example, null.

    +
    +
    +
    +

    +6.2. Programming Language Independence +

    +

    + JSON Schema is programming language agnostic, and supports the full range of + values described in the data model. + Be aware, however, that some languages and JSON parsers may not be able to + represent in memory the full range of values describable by JSON.

    +
    +
    +
    +
    +

    +6.3. Mathematical Integers +

    +

    + Some programming languages and parsers use different internal representations + for floating point numbers than they do for integers.

    +

    + For consistency, integer JSON numbers SHOULD NOT be encoded with a fractional + part.

    +
    +
    +
    +
    +

    +6.4. Regular Expressions +

    +

    + Keywords MAY use regular expressions to express constraints, or constrain + the instance value to be a regular expression. + These regular expressions SHOULD be valid according to the regular expression + dialect described in ECMA-262, section 21.2.1 [ecma262].

    +

    + Regular expressions SHOULD be built with the "u" flag (or equivalent) to provide + Unicode support, or processed in such a way which provides Unicode support as + defined by ECMA-262.

    +

    + Furthermore, given the high disparity in regular expression constructs support, + schema authors SHOULD limit themselves to the following regular expression + tokens:

    +
      +
    • individual Unicode characters, as defined by the JSON specification [RFC8259]; +
    • +
    • simple character classes ([abc]), range character classes ([a-z]); +
    • +
    • complemented character classes ([^abc], [^a-z]); +
    • +
    • simple quantifiers: "+" (one or more), "*" (zero or more), "?" (zero or + one), and their lazy versions ("+?", "*?", "??"); +
    • +
    • range quantifiers: "{x}" (exactly x occurrences), "{x,y}" (at least x, at + most y, occurrences), {x,} (x occurrences or more), and their lazy + versions; +
    • +
    • the beginning-of-input ("^") and end-of-input ("$") anchors; +
    • +
    • simple grouping ("(...)") and alternation ("|"). +
    • +
    +

    + Finally, implementations MUST NOT take regular expressions to be + anchored, neither at the beginning nor at the end. This means, for instance, + the pattern "es" matches "expression".

    +
    +
    +
    +
    +

    +6.5. Extending JSON Schema +

    +

    + Additional schema keywords and schema vocabularies MAY be defined + by any entity. Save for explicit agreement, schema authors SHALL NOT + expect these additional keywords and vocabularies to be supported by + implementations that do not explicitly document such support. + Implementations SHOULD treat keywords they do not support as annotations, + where the value of the keyword is the value of the annotation.

    +

    + Implementations MAY provide the ability to register or load handlers + for vocabularies that they do not support directly. The exact mechanism + for registering and implementing such handlers is implementation-dependent.

    +
    +
    +
    +
    +

    +7. Keyword Behaviors +

    +

    + JSON Schema keywords fall into several general behavior categories. + Assertions validate that an instance satisfies constraints, producing + a boolean result. Annotations attach information that applications + may use in any way they see fit. + Applicators apply subschemas to parts of the instance and combine + their results.

    +

    + Extension keywords SHOULD stay within these categories, keeping in mind + that annotations in particular are extremely flexible. Complex behavior + is usually better delegated to applications on the basis of annotation + data than implemented directly as schema keywords. However, extension + keywords MAY define other behaviors for specialized purposes.

    +

    + Evaluating an instance against a schema involves processing all of the + keywords in the schema against the appropriate locations within the instance. + Typically, applicator keywords are processed until a schema object with no + applicators (and therefore no subschemas) is reached. The appropriate + location in the instance is evaluated against the assertion and + annotation keywords in the schema object, and their results are gathered + into the parent schema according to the rules of the applicator.

    +

    + Evaluation of a parent schema object can complete once all of its + subschemas have been evaluated, although in some circumstances evaluation + may be short-circuited due to assertion results. When annotations are + being collected, some assertion result short-circuiting is not possible + due to the need to examine all subschemas for annotation collection, including + those that cannot further change the assertion result.

    +
    +
    +

    +7.1. Lexical Scope and Dynamic Scope +

    +

    + While most JSON Schema keywords can be evaluated on their own, + or at most need to take into account the values or results of + adjacent keywords in the same schema object, a few have more + complex behavior.

    +

    + The lexical scope of a keyword is determined by the nested JSON + data structure of objects and arrays. The largest such scope + is an entire schema document. The smallest scope is a single + schema object with no subschemas.

    +

    + Keywords MAY be defined with a partial value, such as a URI-reference, + which must be resolved against another value, such as another + URI-reference or a full URI, which is found through the lexical + structure of the JSON document. The "$id", "$ref", and + "$dynamicRef" core keywords, and the "base" JSON Hyper-Schema + keyword, are examples of this sort of behavior.

    +

    + Note that some keywords, such as "$schema", apply to the lexical + scope of the entire schema resource, and therefore MUST only + appear in a schema resource's root schema.

    +

    + Other keywords may take into account the dynamic scope that + exists during the evaluation of a schema, typically together + with an instance document. + The outermost dynamic scope is the schema object at + which processing begins, even if it is not a schema resource root. + The path from this root schema to any particular keyword (that + includes any "$ref" and "$dynamicRef" keywords that may have + been resolved) is considered the keyword's "validation path."

    +

    + Lexical and dynamic scopes align until a reference keyword + is encountered. While following the reference keyword moves processing + from one lexical scope into a different one, from the perspective + of dynamic scope, following a reference is no different from descending + into a subschema present as a value. A keyword on the far side of + that reference that resolves information through the dynamic scope + will consider the originating side of the reference to be their + dynamic parent, rather than examining the local lexically enclosing parent.

    +

    + The concept of dynamic scope is primarily used with "$dynamicRef" and + "$dynamicAnchor", and should be considered an advanced feature + and used with caution when defining additional keywords. It also appears + when reporting errors and collected annotations, as it may be possible + to revisit the same lexical scope repeatedly with different dynamic + scopes. In such cases, it is important to inform the user of the + dynamic path that produced the error or annotation.

    +
    +
    +
    +

    +7.2. Keyword Interactions +

    +

    + Keyword behavior MAY be defined in terms of the annotation results + of subschemas (Section 4.3.5) and/or adjacent keywords + (keywords within the same schema object) and their subschemas. + Such keywords MUST NOT result in a circular dependency. + Keywords MAY modify their behavior based on the presence or absence + of another keyword in the same + schema object (Section 4.3).

    +
    +
    +

    +7.3. Default Behaviors +

    +

    + A missing keyword MUST NOT produce a false assertion result, MUST + NOT produce annotation results, and MUST NOT cause any other schema + to be evaluated as part of its own behavioral definition. + However, given that missing keywords do not contribute annotations, + the lack of annotation results may indirectly change the behavior + of other keywords.

    +

    + In some cases, the missing keyword assertion behavior of a keyword is + identical to that produced by a certain value, and keyword definitions + SHOULD note such values where known. However, even if the value which + produces the default behavior would produce annotation results if + present, the default behavior still MUST NOT result in annotations.

    +

    + Because annotation collection can add significant cost in terms of both + computation and memory, implementations MAY opt out of this feature. + Keywords that are specified in terms of collected annotations SHOULD + describe reasonable alternate approaches when appropriate. + This approach is demonstrated by the + "items" and + "additionalProperties" keywords in this + document.

    +

    + Note that when no such alternate approach is possible for a keyword, + implementations that do not support annotation collections will not + be able to support those keywords or vocabularies that contain them.

    +
    +
    +

    +7.4. Identifiers +

    +

    + Identifiers define URIs for a schema, or affect how such URIs are + resolved in references (Section 8.2.3), or both. + The Core vocabulary defined in this document defines several + identifying keywords, most notably "$id".

    +

    + Canonical schema URIs MUST NOT change while processing an instance, but + keywords that affect URI-reference resolution MAY have behavior that + is only fully determined at runtime.

    +

    + While custom identifier keywords are possible, vocabulary designers should + take care not to disrupt the functioning of core keywords. For example, + the "$dynamicAnchor" keyword in this specification limits its URI resolution + effects to the matching "$dynamicRef" keyword, leaving the behavior + of "$ref" undisturbed.

    +
    +
    +
    +

    +7.5. Applicators +

    +

    + Applicators allow for building more complex schemas than can be accomplished + with a single schema object. Evaluation of an instance against a + schema document (Section 4.3) begins by applying + the root schema (Section 4.3.5) to the complete instance + document. From there, keywords known as applicators are used to determine + which additional schemas are applied. Such schemas may be applied in-place + to the current location, or to a child location.

    +

    + The schemas to be applied may be present as subschemas comprising all or + part of the keyword's value. Alternatively, an applicator may refer to + a schema elsewhere in the same schema document, or in a different one. + The mechanism for identifying such referenced schemas is defined by the + keyword.

    +

    + Applicator keywords also define how subschema or referenced schema + boolean assertion (Section 7.6) + results are modified and/or combined to produce the boolean result + of the applicator. Applicators may apply any boolean logic operation + to the assertion results of subschemas, but MUST NOT introduce new + assertion conditions of their own.

    +

    + Annotation (Section 7.7) results are + preserved along with the instance location and the location of + the schema keyword, so that applications can decide how to + interpret multiple values.

    +
    +
    +

    +7.5.1. Referenced and Referencing Schemas +

    +

    + As noted in Section 7.5, an applicator keyword may + refer to a schema to be applied, rather than including it as a + subschema in the applicator's value. In such situations, the + schema being applied is known as the referenced schema, while + the schema containing the applicator keyword is the referencing schema.

    +

    + While root schemas and subschemas are static concepts based on a + schema's position within a schema document, referenced and referencing + schemas are dynamic. Different pairs of schemas may find themselves + in various referenced and referencing arrangements during the evaluation + of an instance against a schema.

    +

    + For some by-reference applicators, such as + "$ref" (Section 8.2.3.1), the referenced schema can be determined + by static analysis of the schema document's lexical scope. Others, + such as "$dynamicRef" (with "$dynamicAnchor"), may make use of dynamic + scoping, and therefore only be resolvable in the process of evaluating + the schema with an instance.

    +
    +
    +
    +
    +
    +
    +

    +7.6. Assertions +

    +

    + JSON Schema can be used to assert constraints on a JSON document, which + either passes or fails the assertions. This approach can be used to validate + conformance with the constraints, or document what is needed to satisfy them.

    +

    + JSON Schema implementations produce a single boolean result when evaluating + an instance against schema assertions.

    +

    + An instance can only fail an assertion that is present in the schema.

    +
    +

    +7.6.1. Assertions and Instance Primitive Types +

    +

    + Most assertions only constrain values within a certain + primitive type. When the type of the instance is not of the type + targeted by the keyword, the instance is considered to conform + to the assertion.

    +

    + For example, the "maxLength" keyword from the companion + validation vocabulary [json-schema-validation]: + will only restrict certain strings + (that are too long) from being valid. If the instance is a number, + boolean, null, array, or object, then it is valid against this assertion.

    +

    + This behavior allows keywords to be used more easily with instances + that can be of multiple primitive types. The companion validation + vocabulary also includes a "type" keyword which can independently + restrict the instance to one or more primitive types. This allows + for a concise expression of use cases such as a function that might + return either a string of a certain length or a null value:

    +
    +
    +
    +{
    +    "type": ["string", "null"],
    +    "maxLength": 255
    +}
    +
    +
    +
    +

    + If "maxLength" also restricted the instance type to be a string, + then this would be substantially more cumbersome to express because + the example as written would not actually allow null values. + Each keyword is evaluated separately unless explicitly specified + otherwise, so if "maxLength" restricted the instance to strings, + then including "null" in "type" would not have any useful effect.

    +
    +
    +
    +
    +
    +

    +7.7. Annotations +

    +

    + JSON Schema can annotate an instance with information, whenever the instance + validates against the schema object containing the annotation, and all of its + parent schema objects. The information can be a simple value, or can be + calculated based on the instance contents.

    +

    + Annotations are attached to specific locations in an instance. + Since many subschemas can be applied to any single + location, applications may need to decide how to handle differing + annotation values being attached to the same instance location by + the same schema keyword in different schema objects.

    +

    + Unlike assertion results, annotation data can take a wide variety of forms, + which are provided to applications to use as they see fit. JSON Schema + implementations are not expected to make use of the collected information + on behalf of applications.

    +

    + Unless otherwise specified, the value of an annotation keyword + is the keyword's value. However, other behaviors are possible. + For example, JSON Hyper-Schema's [json-hyper-schema] + "links" keyword is a complex annotation that produces a value based + in part on the instance data.

    +

    + While "short-circuit" evaluation is possible for assertions, collecting + annotations requires examining all schemas that apply to an instance + location, even if they cannot change the overall assertion result. + The only exception is that subschemas of a schema object that has + failed validation MAY be skipped, as annotations are not retained + for failing schemas.

    +
    +

    +7.7.1. Collecting Annotations +

    +

    + Annotations are collected by keywords that explicitly define + annotation-collecting behavior. Note that boolean schemas cannot + produce annotations as they do not make use of keywords.

    +

    + A collected annotation MUST include the following information:

    +
      +
    • + The name of the keyword that produces the annotation +
    • +
    • + The instance location to which it is attached, as a JSON Pointer +
    • +
    • + The schema location path, indicating how reference keywords + such as "$ref" were followed to reach the absolute schema location. +
    • +
    • + The absolute schema location of the attaching keyword, as a URI. + This MAY be omitted if it is the same as the schema location path + from above. +
    • +
    • + The attached value(s) +
    • +
    +
    +
    +7.7.1.1. Distinguishing Among Multiple Values +
    +

    + Applications MAY make decisions on which of multiple annotation values + to use based on the schema location that contributed the value. + This is intended to allow flexible usage. Collecting the schema location + facilitates such usage.

    +

    + For example, consider this schema, which uses annotations and assertions from + the Validation specification [json-schema-validation]:

    +

    + Note that some lines are wrapped for clarity.

    +
    +
    +
    +{
    +    "title": "Feature list",
    +    "type": "array",
    +    "prefixItems": [
    +        {
    +            "title": "Feature A",
    +            "properties": {
    +                "enabled": {
    +                    "$ref": "#/$defs/enabledToggle",
    +                    "default": true
    +                }
    +            }
    +        },
    +        {
    +            "title": "Feature B",
    +            "properties": {
    +                "enabled": {
    +                    "description": "If set to null, Feature B
    +                                    inherits the enabled
    +                                    value from Feature A",
    +                    "$ref": "#/$defs/enabledToggle"
    +                }
    +            }
    +        }
    +    ],
    +    "$defs": {
    +        "enabledToggle": {
    +            "title": "Enabled",
    +            "description": "Whether the feature is enabled (true),
    +                            disabled (false), or under
    +                            automatic control (null)",
    +            "type": ["boolean", "null"],
    +            "default": null
    +        }
    +    }
    +}
    +
    +
    +
    +

    + In this example, both Feature A and Feature B make use of the re-usable + "enabledToggle" schema. That schema uses the "title", "description", + and "default" annotations. Therefore the application has to decide how + to handle the additional "default" value for Feature A, and the additional + "description" value for Feature B.

    +

    + The application programmer and the schema author need to agree on the + usage. For this example, let's assume that they agree that the most + specific "default" value will be used, and any additional, more generic + "default" values will be silently ignored. Let's also assume that they + agree that all "description" text is to be used, starting with the most + generic, and ending with the most specific. This requires the schema + author to write descriptions that work when combined in this way.

    +

    + The application can use the schema location path to determine which + values are which. The values in the feature's immediate "enabled" + property schema are more specific, while the values under the re-usable + schema that is referenced to with "$ref" are more generic. The schema + location path will show whether each value was found by crossing a + "$ref" or not.

    +

    + Feature A will therefore use a default value of true, while Feature B + will use the generic default value of null. Feature A will only + have the generic description from the "enabledToggle" schema, while + Feature B will use that description, and also append its locally + defined description that explains how to interpret a null value.

    +

    + Note that there are other reasonable approaches that a different application + might take. For example, an application may consider the presence of + two different values for "default" to be an error, regardless of their + schema locations.

    +
    +
    +
    +7.7.1.2. Annotations and Assertions +
    +

    + Schema objects that produce a false assertion result MUST NOT + produce any annotation results, whether from their own keywords + or from keywords in subschemas.

    +

    + Note that the overall schema results may still include annotations + collected from other schema locations. Given this schema:

    +
    +
    +
    +{
    +    "oneOf": [
    +        {
    +            "title": "Integer Value",
    +            "type": "integer"
    +        },
    +        {
    +            "title": "String Value",
    +            "type": "string"
    +        }
    +    ]
    +}
    +
    +
    +
    +

    + Against the instance "This is a string", the + title annotation "Integer Value" is discarded because the type assertion + in that schema object fails. The title annotation "String Value" + is kept, as the instance passes the string type assertions.

    +
    +
    +
    +7.7.1.3. Annotations and Applicators +
    +

    + In addition to possibly defining annotation results of their own, + applicator keywords aggregate the annotations collected in their + subschema(s) or referenced schema(s).

    +
    +
    +
    +
    +
    +

    +7.8. Reserved Locations +

    +

    + A fourth category of keywords simply reserve a location to hold re-usable + components or data of interest to schema authors that is not suitable + for re-use. These keywords do not affect validation or annotation results. + Their purpose in the core vocabulary is to ensure that locations are + available for certain purposes and will not be redefined by extension + keywords.

    +

    + While these keywords do not directly affect results, as explained in section + 9.4.2 unrecognized + extension keywords that reserve locations for re-usable schemas may have + undesirable interactions with references in certain circumstances.

    +
    +
    +

    +7.9. Loading Instance Data +

    +

    + While none of the vocabularies defined as part of this or the associated documents + define a keyword which may target and/or load instance data, it is possible that + other vocabularies may wish to do so.

    +

    + Keywords MAY be defined to use JSON Pointers or Relative JSON Pointers to examine + parts of an instance outside the current evaluation location.

    +

    + Keywords that allow adjusting the location using a Relative JSON Pointer SHOULD + default to using the current location if a default is desireable.

    +
    +
    +
    +

    +8. The JSON Schema Core Vocabulary +

    +

    + Keywords declared in this section, which all begin with "$", make up + the JSON Schema Core vocabulary. These keywords are either required in + order to process any schema or meta-schema, including those split across + multiple documents, or exist to reserve keywords for purposes that + require guaranteed interoperability.

    +

    + The Core vocabulary MUST be considered mandatory at all times, in order + to bootstrap the processing of further vocabularies. Meta-schemas + that use the "$vocabulary" (Section 8.1) keyword + to declare the vocabularies in use MUST explicitly list the Core vocabulary, + which MUST have a value of true indicating that it is required.

    +

    + The behavior of a false value for this vocabulary (and only this + vocabulary) is undefined, as is the behavior when "$vocabulary" + is present but the Core vocabulary is not included. However, it + is RECOMMENDED that implementations detect these cases and raise + an error when they occur. It is not meaningful to declare that + a meta-schema optionally uses Core.

    +

    + Meta-schemas that do not use "$vocabulary" MUST be considered to + require the Core vocabulary as if its URI were present with a value of true.

    +

    + The current URI for the Core vocabulary is: + <https://json-schema.org/draft/2020-12/vocab/core>.

    +

    + The current URI for the corresponding meta-schema is: + https://json-schema.org/draft/2020-12/meta/core.

    +

    + While the "$" prefix is not formally reserved for the Core vocabulary, + it is RECOMMENDED that extension keywords (in vocabularies or otherwise) + begin with a character other than "$" to avoid possible future collisions.

    +
    +
    +

    +8.1. Meta-Schemas and Vocabularies +

    +

    + Two concepts, meta-schemas and vocabularies, are used to inform an implementation + how to interpret a schema. Every schema has a meta-schema, which can be declared + using the "$schema" keyword.

    +

    + The meta-schema serves two purposes:

    +
    +
    Declaring the vocabularies in use
    +
    + The "$vocabulary" keyword, when it appears in a meta-schema, declares + which vocabularies are available to be used in schemas that refer + to that meta-schema. Vocabularies define keyword semantics, + as well as their general syntax. +
    +
    +
    Describing valid schema syntax
    +
    + A schema MUST successfully validate against its meta-schema, which + constrains the syntax of the available keywords. The syntax described + is expected to be compatible with the vocabularies declared; while + it is possible to describe an incompatible syntax, such a meta-schema + would be unlikely to be useful. +
    +
    +
    +

    + Meta-schemas are separate from vocabularies to allow for + vocabularies to be combined in different ways, and for meta-schema authors + to impose additional constraints such as forbidding certain keywords, or + performing unusually strict syntactical validation, as might be done + during a development and testing cycle. Each vocabulary typically identifies + a meta-schema consisting only of the vocabulary's keywords.

    +

    + Meta-schema authoring is an advanced usage of JSON Schema, so the design of + meta-schema features emphasizes flexibility over simplicity.

    +
    +
    +

    +8.1.1. The "$schema" Keyword +

    +

    + The "$schema" keyword is both used as a JSON Schema dialect identifier and + as the identifier of a resource which is itself a JSON Schema, which describes the + set of valid schemas written for this particular dialect.

    +

    + The value of this keyword MUST be a URI [RFC3986] + (containing a scheme) and this URI MUST be normalized. + The current schema MUST be valid against the meta-schema identified by this URI.

    +

    + If this URI identifies a retrievable resource, that resource SHOULD be of + media type "application/schema+json".

    +

    + The "$schema" keyword SHOULD be used in the document root schema object, + and MAY be used in the root schema objects of embedded schema resources. + It MUST NOT appear in non-resource root schema objects. If absent from + the document root schema, the resulting behavior is implementation-defined.

    +

    + Values for this property are defined elsewhere in this and other documents, + and by other parties.

    +
    +
    +
    +

    +8.1.2. The "$vocabulary" Keyword +

    +

    + The "$vocabulary" keyword is used in meta-schemas to identify the + vocabularies available for use in schemas described by that meta-schema. + It is also used to indicate whether each vocabulary is required or optional, + in the sense that an implementation MUST understand the required vocabularies + in order to successfully process the schema. Together, this information forms + a dialect. Any vocabulary that is understood by the implementation MUST be + processed in a manner consistent with the semantic definitions contained + within the vocabulary.

    +

    + The value of this keyword MUST be an object. The property names in the + object MUST be URIs (containing a scheme) and this URI MUST be normalized. + Each URI that appears as a property name identifies a specific set of + keywords and their semantics.

    +

    + The URI MAY be a URL, but the nature of the retrievable resource is + currently undefined, and reserved for future use. Vocabulary authors + MAY use the URL of the vocabulary specification, in a human-readable + media type such as text/html or text/plain, as the vocabulary URI. + + Vocabulary documents may be added in forthcoming drafts. + For now, identifying the keyword set is deemed sufficient as that, + along with meta-schema validation, is how the current "vocabularies" + work today. Any future vocabulary document format will be specified + as a JSON document, so using text/html or other non-JSON formats + in the meantime will not produce any future ambiguity. +

    +

    + The values of the object properties MUST be booleans. + If the value is true, then implementations that do not recognize + the vocabulary MUST refuse to process any schemas that declare + this meta-schema with "$schema". If the value is false, implementations + that do not recognize the vocabulary SHOULD proceed with processing + such schemas. The value has no impact if the implementation + understands the vocabulary.

    +

    + Per 6.5, unrecognized + keywords SHOULD be treated as annotations. + This remains the case for keywords defined + by unrecognized vocabularies. It is not currently possible to distinguish + between unrecognized keywords that are defined in vocabularies from + those that are not part of any vocabulary.

    +

    + The "$vocabulary" keyword SHOULD be used in the root schema of any schema + document intended for use as a meta-schema. It MUST NOT appear in subschemas.

    +

    + The "$vocabulary" keyword MUST be ignored in schema documents that + are not being processed as a meta-schema. This allows validating + a meta-schema M against its own meta-schema M' without requiring + the validator to understand the vocabularies declared by M.

    +
    +
    +8.1.2.1. Default vocabularies +
    +

    + If "$vocabulary" is absent, an implementation MAY determine + behavior based on the meta-schema if it is recognized from the + URI value of the referring schema's "$schema" keyword. + This is how behavior (such as Hyper-Schema usage) has been + recognized prior to the existence of vocabularies.

    +

    + If the meta-schema, as referenced by the schema, is not recognized, + or is missing, then the behavior is implementation-defined. + If the implementation + proceeds with processing the schema, it MUST assume the use of the + core vocabulary. If the implementation is built for a specific purpose, + then it SHOULD assume the use of all of the most relevant vocabularies + for that purpose.

    +

    + For example, an implementation that is a validator + SHOULD assume the use of all vocabularies in this + specification and the companion Validation specification.

    +
    +
    +
    +8.1.2.2. Non-inheritability of vocabularies +
    +

    + Note that the processing restrictions on "$vocabulary" mean that + meta-schemas that reference other meta-schemas using "$ref" or + similar keywords do not automatically inherit the vocabulary + declarations of those other meta-schemas. All such declarations + must be repeated in the root of each schema document intended + for use as a meta-schema. This is demonstrated in + the example meta-schema (Appendix D.2). + + This requirement allows implementations to find all vocabulary + requirement information in a single place for each meta-schema. + As schema extensibility means that there are endless potential + ways to combine more fine-grained meta-schemas by reference, + requiring implementations to anticipate all possibilities and + search for vocabularies in referenced meta-schemas would + be overly burdensome. +

    +
    +
    +
    +

    +8.1.3. Updates to Meta-Schema and Vocabulary URIs +

    +

    + Updated vocabulary and meta-schema URIs MAY be published between + specification drafts in order to correct errors. Implementations + SHOULD consider URIs dated after this specification draft and + before the next to indicate the same syntax and semantics + as those listed here.

    +
    +
    +
    +
    +

    +8.2. Base URI, Anchors, and Dereferencing +

    +

    + To differentiate between schemas in a vast ecosystem, schemas are + identified by URI [RFC3986], and can embed references + to other schemas by specifying their URI.

    +

    + Several keywords can accept a relative URI-reference [RFC3986], + or a value used to construct a relative URI-reference. For these keywords, + it is necessary to establish a base URI in order to resolve the reference.

    +
    +
    +

    +8.2.1. The "$id" Keyword +

    +

    + The "$id" keyword identifies a schema resource with its + canonical [RFC6596] URI.

    +

    + Note that this URI is an identifier and not necessarily a network locator. + In the case of a network-addressable URL, a schema need not be downloadable + from its canonical URI.

    +

    + If present, the value for this keyword MUST be a string, and MUST represent a + valid URI-reference [RFC3986]. This URI-reference + SHOULD be normalized, and MUST resolve to an + absolute-URI [RFC3986] (without a fragment), + or to a URI with an empty fragment.

    +

    + The empty fragment form is NOT RECOMMENDED and is retained only + for backwards compatibility, and because the + application/schema+json media type defines that a URI with an + empty fragment identifies the same resource as the same URI + with the fragment removed. However, since this equivalence is not + part of the RFC 3986 normalization process [RFC3986], + implementers and schema authors cannot rely on generic URI libraries + understanding it.

    +

    + Therefore, "$id" MUST NOT contain a non-empty fragment, and SHOULD NOT + contain an empty fragment. The absolute-URI form MUST be considered + the canonical URI, regardless of the presence or absence of an empty fragment. + + An empty fragment is currently allowed because older meta-schemas have + an empty fragment in their $id (or previously, id). + A future draft may outright forbid even empty fragments in "$id". +

    +

    + The absolute-URI also serves as the base URI for relative URI-references + in keywords within the schema resource, in accordance with + RFC 3986 section 5.1.1 [RFC3986] regarding base URIs + embedded in content.

    +

    + The presence of "$id" in a subschema indicates that the subschema constitutes + a distinct schema resource within a single schema document. Furthermore, + in accordance with RFC 3986 section 5.1.2 [RFC3986] + regarding encapsulating entities, if an "$id" in a subschema is a relative + URI-reference, the base URI for resolving that reference is the URI of + the parent schema resource.

    +

    + If no parent schema object explicitly identifies itself as a resource + with "$id", the base URI is that of the entire document, as established + by the steps given in the previous section. (Section 9.1.1)

    +
    +
    +8.2.1.1. Identifying the root schema +
    +

    + The root schema of a JSON Schema document SHOULD contain an "$id" keyword + with an absolute-URI [RFC3986] (containing a scheme, + but no fragment).

    +
    +
    +
    +
    +
    +

    +8.2.2. Defining location-independent identifiers +

    +

    + Using JSON Pointer fragments requires knowledge of the structure of the schema. + When writing schema documents with the intention to provide re-usable + schemas, it may be preferable to use a plain name fragment that is not tied to + any particular structural location. This allows a subschema to be relocated + without requiring JSON Pointer references to be updated.

    +

    + The "$anchor" and "$dynamicAnchor" keywords are used to specify such + fragments. They are identifier keywords that can only be used to create + plain name fragments, rather than absolute URIs as seen with "$id".

    +

    + The base URI to which the resulting fragment is appended is the canonical + URI of the schema resource containing the "$anchor" or "$dynamicAnchor" + in question. As discussed in the previous section, this is either the + nearest "$id" in the same or parent schema object, or the base URI + for the document as determined according to RFC 3986.

    +

    + Separately from the usual usage of URIs, "$dynamicAnchor" + indicates that the fragment is an extension point when used with + the "$dynamicRef" keyword. This low-level, advanced feature + makes it easier to extend recursive schemas such as the meta-schemas, + without imposing any particular semantics on that extension. + See the section on "$dynamicRef" (Section 8.2.3.2) + for details.

    +

    + In most cases, the normal fragment behavior both suffices and + is more intuitive. Therefore it is RECOMMENDED that "$anchor" + be used to create plain name fragments unless there is a clear + need for "$dynamicAnchor".

    +

    + If present, the value of this keyword MUST be a string and MUST start with + a letter ([A-Za-z]) or underscore ("_"), followed by any number of letters, + digits ([0-9]), hyphens ("-"), underscores ("_"), and periods ("."). + This matches the US-ASCII part of XML's + NCName production [xml-names]. + + Note that the anchor string does not include the "#" character, + as it is not a URI-reference. An "$anchor": "foo" becomes the + fragment "#foo" when used in a URI. See below for full examples. +

    +

    + The effect of specifying the same fragment name multiple times within + the same resource, using any combination of "$anchor" and/or + "$dynamicAnchor", is undefined. Implementations MAY + raise an error if such usage is detected.

    +
    +
    +
    +
    +

    +8.2.3. Schema References +

    +

    + Several keywords can be used to reference a schema which is to be applied to the + current instance location. "$ref" and "$dynamicRef" are applicator + keywords, applying the referenced schema to the instance.

    +

    + As the values of "$ref" and "$dynamicRef" are URI References, this allows + the possibility to externalise or divide a schema across multiple files, + and provides the ability to validate recursive structures through + self-reference.

    +

    + The resolved URI produced by these keywords is not necessarily a network + locator, only an identifier. A schema need not be downloadable from the + address if it is a network-addressable URL, and implementations SHOULD NOT + assume they should perform a network operation when they encounter + a network-addressable URI.

    +
    +
    +
    +8.2.3.1. Direct References with "$ref" +
    +

    + The "$ref" keyword is an applicator that is used to reference a statically + identified schema. Its results are the results of the referenced schema. + + Note that this definition of how the results are determined means that + other keywords can appear alongside of "$ref" in the same schema object. +

    +

    + The value of the "$ref" keyword MUST be a string which is a URI-Reference. + Resolved against the current URI base, it produces the URI of the schema + to apply. This resolution is safe to perform on schema load, as the + process of evaluating an instance cannot change how the reference resolves.

    +
    +
    +
    +
    +
    +8.2.3.2. Dynamic References with "$dynamicRef" +
    +

    + The "$dynamicRef" keyword is an applicator that allows for deferring the + full resolution until runtime, at which point it is resolved each time it is + encountered while evaluating an instance.

    +

    + Together with "$dynamicAnchor", "$dynamicRef" implements a cooperative + extension mechanism that is primarily useful with recursive schemas + (schemas that reference themselves). Both the extension point and the + runtime-determined extension target are defined with "$dynamicAnchor", + and only exhibit runtime dynamic behavior when referenced with + "$dynamicRef".

    +

    + The value of the "$dynamicRef" property MUST be a string which is + a URI-Reference. Resolved against the current URI base, it produces + the URI used as the starting point for runtime resolution. This initial + resolution is safe to perform on schema load.

    +

    + If the initially resolved starting point URI includes a fragment that + was created by the "$dynamicAnchor" keyword, the initial URI MUST be + replaced by the URI (including the fragment) for the outermost schema + resource in the dynamic scope (Section 7.1) that defines + an identically named fragment with "$dynamicAnchor".

    +

    + Otherwise, its behavior is identical to "$ref", and no runtime + resolution is needed.

    +

    + For a full example using these keyword, see appendix + C. + + The difference between the hyper-schema meta-schema in pre-2019 + drafts and an this draft dramatically demonstrates the utility + of these keywords. +

    +
    +
    +
    +
    +
    +
    +

    +8.2.4. Schema Re-Use With "$defs" +

    +

    + The "$defs" keyword reserves a location for schema + authors to inline re-usable JSON Schemas into a more general schema. + The keyword does not directly affect the validation result.

    +

    + This keyword's value MUST be an object. + Each member value of this object MUST be a valid JSON Schema.

    +

    + As an example, here is a schema describing an array of positive + integers, where the positive integer constraint is a subschema in + "$defs":

    +
    +
    +
    +{
    +    "type": "array",
    +    "items": { "$ref": "#/$defs/positiveInteger" },
    +    "$defs": {
    +        "positiveInteger": {
    +            "type": "integer",
    +            "exclusiveMinimum": 0
    +        }
    +    }
    +}
    +
    +
    +
    +
    +
    +
    +
    +

    +8.3. Comments With "$comment" +

    +

    + This keyword reserves a location for comments from schema authors + to readers or maintainers of the schema.

    +

    + The value of this keyword MUST be a string. Implementations MUST NOT present this + string to end users. Tools for editing schemas SHOULD support displaying and + editing this keyword. The value of this keyword MAY be used in debug or error + output which is intended for developers making use of schemas.

    +

    + Schema vocabularies SHOULD allow "$comment" within any object containing + vocabulary keywords. Implementations MAY assume "$comment" is allowed + unless the vocabulary specifically forbids it. Vocabularies MUST NOT + specify any effect of "$comment" beyond what is described in this + specification.

    +

    + Tools that translate other media types or programming languages + to and from application/schema+json MAY choose to convert that media type or + programming language's native comments to or from "$comment" values. + The behavior of such translation when both native comments and "$comment" + properties are present is implementation-dependent.

    +

    + Implementations MAY strip "$comment" values at any point during processing. + In particular, this allows for shortening schemas when the size of deployed + schemas is a concern.

    +

    + Implementations MUST NOT take any other action based on the presence, absence, + or contents of "$comment" properties. In particular, the value of "$comment" + MUST NOT be collected as an annotation result.

    +
    +
    +
    +

    +9. Loading and Processing Schemas +

    +

    +
    +

    +9.1. Loading a Schema +

    +
    +
    +

    +9.1.1. Initial Base URI +

    +

    + RFC3986 Section 5.1 [RFC3986] defines how to determine the + default base URI of a document.

    +

    + Informatively, the initial base URI of a schema is the URI at which it was + found, whether that was a network location, a local filesystem, or any other + situation identifiable by a URI of any known scheme.

    +

    + If a schema document defines no explicit base URI with "$id" + (embedded in content), the base URI is that determined per + RFC 3986 section 5 [RFC3986].

    +

    + If no source is known, or no URI scheme is known for the source, a suitable + implementation-specific default URI MAY be used as described in + RFC 3986 Section 5.1.4 [RFC3986]. It is RECOMMENDED + that implementations document any default base URI that they assume.

    +

    + If a schema object is embedded in a document of another media type, then + the initial base URI is determined according to the rules of that + media type.

    +

    + Unless the "$id" keyword described in an earlier section is present in the + root schema, this base URI SHOULD be considered the canonical URI of the + schema document's root schema resource.

    +
    +
    +
    +

    +9.1.2. Loading a referenced schema +

    +

    + The use of URIs to identify remote schemas does not necessarily mean anything is downloaded, + but instead JSON Schema implementations SHOULD understand ahead of time which schemas they will be using, + and the URIs that identify them.

    +

    + When schemas are downloaded, + for example by a generic user-agent that does not know until runtime which schemas to download, + see Usage for Hypermedia (Section 9.5.1).

    +

    + Implementations SHOULD be able to associate arbitrary URIs with an arbitrary + schema and/or automatically associate a schema's "$id"-given URI, depending + on the trust that the validator has in the schema. Such URIs and schemas + can be supplied to an implementation prior to processing instances, or may + be noted within a schema document as it is processed, producing associations + as shown in appendix A.

    +

    + A schema MAY (and likely will) have multiple URIs, but there is no way for a + URI to identify more than one schema. When multiple schemas try to identify + as the same URI, validators SHOULD raise an error condition.

    +
    +
    +

    +9.1.3. Detecting a Meta-Schema +

    +

    + Implementations MUST recognize a schema as a meta-schema if it + is being examined because it was identified as such by another + schema's "$schema" keyword. This means that a single schema + document might sometimes be considered a regular schema, and + other times be considered a meta-schema.

    +

    + In the case of examining a schema which is its own meta-schema, + when an implementation begins processing it as a regular schema, + it is processed under those rules. However, when loaded a second + time as a result of checking its own "$schema" value, it is treated + as a meta-schema. So the same document is processed both ways in + the course of one session.

    +

    + Implementations MAY allow a schema to be explicitly passed as a meta-schema, + for implementation-specific purposes, such as pre-loading a commonly + used meta-schema and checking its vocabulary support requirements + up front. Meta-schema authors MUST NOT expect such features to be + interoperable across implementations.

    +
    +
    +
    +

    +9.2. Dereferencing +

    +

    + Schemas can be identified by any URI that has been given to them, including + a JSON Pointer or their URI given directly by "$id". In all cases, + dereferencing a "$ref" reference involves first resolving its value as a + URI reference against the current base URI per + RFC 3986 [RFC3986].

    +

    + If the resulting URI identifies a schema within the current document, or + within another schema document that has been made available to the implementation, + then that schema SHOULD be used automatically.

    +

    + For example, consider this schema:

    +
    +
    +
    +{
    +    "$id": "https://example.net/root.json",
    +    "items": {
    +        "type": "array",
    +        "items": { "$ref": "#item" }
    +    },
    +    "$defs": {
    +        "single": {
    +            "$anchor": "item",
    +            "type": "object",
    +            "additionalProperties": { "$ref": "other.json" }
    +        }
    +    }
    +}
    +
    +
    +
    +

    + When an implementation encounters the <#/$defs/single> schema, + it resolves the "$anchor" value as a fragment name against the current + base URI to form <https://example.net/root.json#item>.

    +

    + When an implementation then looks inside the <#/items> schema, it + encounters the <#item> reference, and resolves this to + <https://example.net/root.json#item>, which it has seen defined in + this same document and can therefore use automatically.

    +

    + When an implementation encounters the reference to "other.json", it resolves + this to <https://example.net/other.json>, which is not defined in this + document. If a schema with that identifier has otherwise been supplied to + the implementation, it can also be used automatically. + + What should implementations do when the referenced schema is not known? + Are there circumstances in which automatic network dereferencing is + allowed? A same origin policy? A user-configurable option? In the + case of an evolving API described by Hyper-Schema, it is expected that + new schemas will be added to the system dynamically, so placing an + absolute requirement of pre-loading schema documents is not feasible. +

    +
    +
    +

    +9.2.1. JSON Pointer fragments and embedded schema resources +

    +

    + Since JSON Pointer URI fragments are constructed based on the structure + of the schema document, an embedded schema resource and its subschemas + can be identified by JSON Pointer fragments relative to either its own + canonical URI, or relative to any containing resource's URI.

    +

    + Conceptually, a set of linked schema resources should behave + identically whether each resource is a separate document connected with + schema references (Section 8.2.3), or is structured as + a single document with one or more schema resources embedded as + subschemas.

    +

    + Since URIs involving JSON Pointer fragments relative to the parent + schema resource's URI cease to be valid when the embedded schema + is moved to a separate document and referenced, applications and schemas + SHOULD NOT use such URIs to identify embedded schema resources or + locations within them.

    +

    + Consider the following schema document that contains another + schema resource embedded within it:

    +
    +
    +
    +{
    +    "$id": "https://example.com/foo",
    +    "items": {
    +        "$id": "https://example.com/bar",
    +        "additionalProperties": { }
    +    }
    +}
    +
    +
    +
    +

    + The URI "https://example.com/foo#/items" points to the "items" schema, + which is an embedded resource. The canonical URI of that schema + resource, however, is "https://example.com/bar".

    +

    + For the "additionalProperties" schema within that embedded resource, + the URI "https://example.com/foo#/items/additionalProperties" points + to the correct object, but that object's URI relative to its resource's + canonical URI is "https://example.com/bar#/additionalProperties".

    +

    + Now consider the following two schema resources linked by reference + using a URI value for "$ref":

    +
    +
    +
    +{
    +    "$id": "https://example.com/foo",
    +    "items": {
    +        "$ref": "bar"
    +    }
    +}
    +
    +{
    +    "$id": "https://example.com/bar",
    +    "additionalProperties": { }
    +}
    +
    +
    +
    +

    + Here we see that "https://example.com/bar#/additionalProperties", + using a JSON Pointer fragment appended to the canonical URI of + the "bar" schema resource, is still valid, while + "https://example.com/foo#/items/additionalProperties", which relied + on a JSON Pointer fragment appended to the canonical URI of the + "foo" schema resource, no longer resolves to anything.

    +

    + Note also that "https://example.com/foo#/items" is valid in both + arrangements, but resolves to a different value. This URI ends up + functioning similarly to a retrieval URI for a resource. While this URI + is valid, it is more robust to use the "$id" of the embedded or referenced + resource unless it is specifically desired to identify the object containing + the "$ref" in the second (non-embedded) arrangement.

    +

    + An implementation MAY choose not to support addressing schema resource + contents by URIs using a base other than the resource's canonical URI, + plus a JSON Pointer fragment relative to that base. Therefore, schema + authors SHOULD NOT rely on such URIs, as using them may reduce interoperability. + + This is to avoid requiring implementations to keep track of a whole + stack of possible base URIs and JSON Pointer fragments for each, + given that all but one will be fragile if the schema resources + are reorganized. Some + have argued that this is easy so there is + no point in forbidding it, while others have argued that it complicates + schema identification and should be forbidden. Feedback on this + topic is encouraged. + After some discussion, we feel that we need to remove the use of + "canonical" in favour of talking about JSON Pointers which reference + across schema resource boundaries as undefined or even forbidden behavior + (https://github.com/json-schema-org/json-schema-spec/issues/937, + https://github.com/json-schema-org/json-schema-spec/issues/1183) +

    +

    + Further examples of such non-canonical URI construction, as well as + the appropriate canonical URI-based fragments to use instead, + are provided in appendix A.

    +
    +
    +
    +
    +

    +9.3. Compound Documents +

    +

    + A Compound Schema Document is defined as a JSON document (sometimes called a "bundled" schema) + which has multiple embedded JSON Schema Resources bundled into the same document to + ease transportation.

    +

    + Each embedded Schema Resource MUST be treated as an individual Schema Resource, following standard + schema loading and processing requirements, including determining vocabulary support.

    +
    +

    +9.3.1. Bundling +

    +

    + The bundling process for creating a Compound Schema Document is defined as taking + references (such as "$ref") to an external Schema Resource and embedding the referenced + Schema Resources within the referring document. Bundling SHOULD be done in such a way that + all URIs (used for referencing) in the base document and any referenced/embedded + documents do not require altering.

    +

    + Each embedded JSON Schema Resource MUST identify itself with a URI using the "$id" keyword, + and SHOULD make use of the "$schema" keyword to identify the dialect it is using, in the root of the + schema resource. It is RECOMMENDED that the URI identifier value of "$id" be an Absolute URI.

    +

    + When the Schema Resource referenced by a by-reference applicator is bundled, it is RECOMMENDED that + the Schema Resource be located as a value of a "$defs" object at the containing schema's root. + The key of the "$defs" for the now embedded Schema Resource MAY be the "$id" of the bundled schema + or some other form of application defined unique identifer (such as a UUID). This key is not + intended to be referenced in JSON Schema, but may be used by an application to aid the + bundling process.

    +

    + A Schema Resource MAY be embedded in a location other than "$defs" where the location is defined + as a schema value.

    +

    + A Bundled Schema Resource MUST NOT be bundled by replacing the schema object from which it was + referenced, or by wrapping the Schema Resource in other applicator keywords.

    +

    + In order to produce identical output, references in the containing schema document to the + previously external Schema Resources MUST NOT be changed, and now resolve to a schema using the + "$id" of an embedded Schema Resource. Such identical output includes validation evaluation and URIs + or paths used in resulting annotations or errors.

    +

    + While the bundling process will often be the main method for creating a Compound Schema Document, + it is also possible and expected that some will be created by hand, potentially without individual + Schema Resources existing on their own previously.

    +
    +
    +

    +9.3.2. Differing and Default Dialects +

    +

    + When multiple schema resources are present in a single document, + schema resources which do not define with which dialect they should be processed + MUST be processed with the same dialect as the enclosing resource.

    +

    + Since any schema that can be referenced can also be embedded, embedded schema resources MAY + specify different processing dialects using the "$schema" values from their enclosing resource.

    +
    +
    +

    +9.3.3. Validating +

    +

    + Given that a Compound Schema Document may have embedded resources which identify as using different + dialects, these documents SHOULD NOT be validated by applying a meta-schema + to the Compound Schema Document as an instance. It is RECOMMENDED that an alternate + validation process be provided in order to validate Schema Documents. Each Schema Resource + SHOULD be separately validated against its associated meta-schema. + + If you know a schema is what's being validated, you can identify if the schemas + is a Compound Schema Document or not, by way of use of "$id", which identifies an + embedded resource when used not at the document's root. +

    +

    + A Compound Schema Document in which all embedded resources identify as using the same + dialect, or in which "$schema" is omitted and therefore defaults to that of the enclosing resource, + MAY be validated by applying the appropriate meta-schema.

    +
    +
    +
    +

    +9.4. Caveats +

    +
    +

    +9.4.1. Guarding Against Infinite Recursion +

    +

    + A schema MUST NOT be run into an infinite loop against an instance. For + example, if two schemas "#alice" and "#bob" both have an "allOf" property + that refers to the other, a naive validator might get stuck in an infinite + recursive loop trying to validate the instance. Schemas SHOULD NOT make + use of infinite recursive nesting like this; the behavior is undefined.

    +
    +
    +
    +

    +9.4.2. References to Possible Non-Schemas +

    +

    + Subschema objects (or booleans) are recognized by their use with known + applicator keywords or with location-reserving keywords such as + "$defs" (Section 8.2.4) that take one or more subschemas + as a value. These keywords may be "$defs" and the standard applicators + from this document, or extension keywords from a known vocabulary, or + implementation-specific custom keywords.

    +

    + Multi-level structures of unknown keywords are capable of introducing + nested subschemas, which would be subject to the processing rules for + "$id". Therefore, having a reference target in such an unrecognized + structure cannot be reliably implemented, and the resulting behavior + is undefined. Similarly, a reference target under a known keyword, + for which the value is known not to be a schema, results in undefined + behavior in order to avoid burdening implementations with the need + to detect such targets. + + These scenarios are analogous to fetching a schema over HTTP + but receiving a response with a Content-Type other than + application/schema+json. An implementation can certainly + try to interpret it as a schema, but the origin server + offered no guarantee that it actually is any such thing. + Therefore, interpreting it as such has security implications + and may produce unpredictable results. +

    +

    + Note that single-level custom keywords with identical syntax and + semantics to "$defs" do not allow for any intervening "$id" keywords, + and therefore will behave correctly under implementations that attempt + to use any reference target as a schema. However, this behavior is + implementation-specific and MUST NOT be relied upon for interoperability.

    +
    +
    +
    +
    +

    +9.5. Associating Instances and Schemas +

    +
    +
    +

    +9.5.1. Usage for Hypermedia +

    +

    + JSON has been adopted widely by HTTP servers for automated APIs and robots. This + section describes how to enhance processing of JSON documents in a more RESTful + manner when used with protocols that support media types and + Web linking [RFC8288].

    +
    +
    +9.5.1.1. Linking to a Schema +
    +

    + It is RECOMMENDED that instances described by a schema provide a link to + a downloadable JSON Schema using the link relation "describedby", as defined by + Linked Data Protocol 1.0, section 8.1 [W3C.REC-ldp-20150226].

    +

    + In HTTP, such links can be attached to any response using the + Link header [RFC8288]. An example of such a header would be:

    +
    +
    +
    +        Link: <https://example.com/my-hyper-schema>; rel="describedby"
    +
    +
    +
    +
    +
    +
    +9.5.1.2. Usage Over HTTP +
    +

    + When used for hypermedia systems over a network, + HTTP [RFC7231] is frequently the protocol of choice for + distributing schemas. Misbehaving clients can pose problems for server + maintainers if they pull a schema over the network more frequently than + necessary, when it's instead possible to cache a schema for a long period of + time.

    +

    + HTTP servers SHOULD set long-lived caching headers on JSON Schemas. + HTTP clients SHOULD observe caching headers and not re-request documents within + their freshness period. + Distributed systems SHOULD make use of a shared cache and/or caching proxy.

    +

    + Clients SHOULD set or prepend a User-Agent header specific to the JSON Schema + implementation or software product. Since symbols are listed in decreasing order + of significance, the JSON Schema library name/version should precede the more + generic HTTP library name (if any). For example:

    +
    +
    +
    +        User-Agent: product-name/5.4.1 so-cool-json-schema/1.0.2 curl/7.43.0
    +
    +
    +
    +

    + Clients SHOULD be able to make requests with a "From" header so that server + operators can contact the owner of a potentially misbehaving script.

    +
    +
    +
    +
    +
    +
    +

    +10. A Vocabulary for Applying Subschemas +

    +

    + This section defines a vocabulary of applicator keywords that + are RECOMMENDED for use as the basis of other vocabularies.

    +

    + Meta-schemas that do not use "$vocabulary" SHOULD be considered to + require this vocabulary as if its URI were present with a value of true.

    +

    + The current URI for this vocabulary, known as the Applicator vocabulary, is: + <https://json-schema.org/draft/2020-12/vocab/applicator>.

    +

    + The current URI for the corresponding meta-schema is: + https://json-schema.org/draft/2020-12/meta/applicator.

    +
    +

    +10.1. Keyword Independence +

    +

    + Schema keywords typically operate independently, without + affecting each other's outcomes.

    +

    + For schema author convenience, there are some exceptions among the + keywords in this vocabulary:

    +
      +
    • + "additionalProperties", whose behavior is defined in terms of + "properties" and "patternProperties" +
    • +
    • + "items", whose behavior is defined in terms of "prefixItems" +
    • +
    • + "contains", whose behavior is affected by the presence and value of + "minContains", in the Validation vocabulary +
    • +
    +
    +
    +
    +

    +10.2. Keywords for Applying Subschemas in Place +

    +

    + These keywords apply subschemas to the same location in the instance + as the parent schema is being applied. They allow combining + or modifying the subschema results in various ways.

    +

    + Subschemas of these keywords evaluate the instance completely independently + such that the results of one such subschema MUST NOT impact the results of sibling + subschemas. Therefore subschemas may be applied in + any order.

    +
    +
    +

    +10.2.1. Keywords for Applying Subschemas With Logic +

    +

    + These keywords correspond to logical operators for combining or modifying + the boolean assertion results of the subschemas. They have no direct + impact on annotation collection, although they enable the same annotation + keyword to be applied to an instance location with different values. + Annotation keywords define their own rules for combining such values.

    +
    +
    +
    +10.2.1.1. allOf +
    +

    + This keyword's value MUST be a non-empty array. + Each item of the array MUST be a valid JSON Schema.

    +

    + An instance validates successfully against this keyword if it validates + successfully against all schemas defined by this keyword's value.

    +
    +
    +
    +
    +10.2.1.2. anyOf +
    +

    + This keyword's value MUST be a non-empty array. + Each item of the array MUST be a valid JSON Schema.

    +

    + An instance validates successfully against this keyword if it validates + successfully against at least one schema defined by this keyword's value. + Note that when annotations are being collected, all subschemas MUST + be examined so that annotations are collected from each subschema + that validates successfully.

    +
    +
    +
    +10.2.1.3. oneOf +
    +

    + This keyword's value MUST be a non-empty array. + Each item of the array MUST be a valid JSON Schema.

    +

    + An instance validates successfully against this keyword if it validates + successfully against exactly one schema defined by this keyword's value.

    +
    +
    +
    +
    +10.2.1.4. not +
    +

    + This keyword's value MUST be a valid JSON Schema.

    +

    + An instance is valid against this keyword if it fails to validate + successfully against the schema defined by this keyword.

    +
    +
    +
    +
    +
    +
    +

    +10.2.2. Keywords for Applying Subschemas Conditionally +

    +

    + Three of these keywords work together to implement conditional + application of a subschema based on the outcome of another subschema. + The fourth is a shortcut for a specific conditional case.

    +

    + "if", "then", and "else" MUST NOT interact with each other across + subschema boundaries. In other words, an "if" in one + branch of an "allOf" MUST NOT have an impact on a "then" + or "else" in another branch.

    +

    + There is no default behavior for "if", "then", or "else" + when they are not present. In particular, they MUST NOT + be treated as if present with an empty schema, and when + "if" is not present, both "then" and "else" MUST be + entirely ignored.

    +
    +
    +10.2.2.1. if +
    +

    + This keyword's value MUST be a valid JSON Schema.

    +

    + This validation outcome of this keyword's subschema + has no direct effect on the overall validation + result. Rather, it controls which of the "then" + or "else" keywords are evaluated.

    +

    + Instances that successfully validate against this + keyword's subschema MUST also be valid against + the subschema value of the "then" keyword, if + present.

    +

    + Instances that fail to validate against this + keyword's subschema MUST also be valid against + the subschema value of the "else" keyword, if + present.

    +

    + If annotations (Section 7.7) + are being collected, they are collected from this + keyword's subschema in the usual way, including when + the keyword is present without either "then" or "else".

    +
    +
    +
    +10.2.2.2. then +
    +

    + This keyword's value MUST be a valid JSON Schema.

    +

    + When "if" is present, and the instance successfully + validates against its subschema, then validation + succeeds against this keyword if the instance also + successfully validates against this keyword's subschema.

    +

    + This keyword has no effect when "if" is absent, or + when the instance fails to validate against its + subschema. Implementations MUST NOT evaluate + the instance against this keyword, for either validation + or annotation collection purposes, in such cases.

    +
    +
    +
    +10.2.2.3. else +
    +

    + This keyword's value MUST be a valid JSON Schema.

    +

    + When "if" is present, and the instance fails to + validate against its subschema, then validation + succeeds against this keyword if the instance + successfully validates against this keyword's subschema.

    +

    + This keyword has no effect when "if" is absent, or + when the instance successfully validates against its + subschema. Implementations MUST NOT evaluate + the instance against this keyword, for either validation + or annotation collection purposes, in such cases.

    +
    +
    +
    +10.2.2.4. dependentSchemas +
    +

    + This keyword specifies subschemas that are evaluated if the instance + is an object and contains a certain property.

    +

    + This keyword's value MUST be an object. + Each value in the object MUST be a valid JSON Schema.

    +

    + If the object key is a property in the instance, the entire + instance must validate against the subschema. Its use is + dependent on the presence of the property.

    +

    + Omitting this keyword has the same behavior as an empty object.

    +
    +
    +
    +
    +
    +
    +

    +10.3. Keywords for Applying Subschemas to Child Instances +

    +

    + Each of these keywords defines a rule for applying its + subschema(s) to child instances, specifically object + properties and array items, and combining their results.

    +
    +

    +10.3.1. Keywords for Applying Subschemas to Arrays +

    +
    +
    +10.3.1.1. prefixItems +
    +

    + The value of "prefixItems" MUST be a non-empty array of valid JSON Schemas.

    +

    + Validation succeeds if each element of the instance validates + against the schema at the same position, if any. This keyword + does not constrain the length of the array. If the array is longer + than this keyword's value, this keyword validates only the + prefix of matching length.

    +

    + This keyword produces an annotation value which is the largest + index to which this keyword applied a subschema. The value + MAY be a boolean true if a subschema was applied to every + index of the instance, such as is produced by the "items" keyword. + This annotation affects the behavior of "items" and "unevaluatedItems".

    +

    + Omitting this keyword has the same assertion behavior as + an empty array.

    +
    +
    +
    +
    +10.3.1.2. items +
    +

    + The value of "items" MUST be a valid JSON Schema.

    +

    + This keyword applies its subschema to all instance elements + at indexes greater than the length of the "prefixItems" array + in the same schema object, as reported by the annotation result + of that "prefixItems" keyword. If no such annotation + result exists, "items" applies its subschema to all instance + array elements. + + Note that the behavior of "items" without "prefixItems" is + identical to that of the schema form of "items" in prior drafts. + When "prefixItems" is present, the behavior of "items" is + identical to the former "additionalItems" keyword. +

    +

    + If the "items" subschema is applied to any + positions within the instance array, it produces an + annotation result of boolean true, indicating that all remaining array + elements have been evaluated against this keyword's subschema. + This annotation affects the behavior of "unevaluatedItems" in the + Unevaluated vocabulary.

    +

    + Omitting this keyword has the same assertion behavior as + an empty schema.

    +

    + Implementations MAY choose to implement or optimize this keyword + in another way that produces the same effect, such as by directly + checking for the presence and size of a "prefixItems" array. + Implementations that do not support annotation collection MUST do so.

    +
    +
    +
    +
    +10.3.1.3. contains +
    +

    + The value of this keyword MUST be a valid JSON Schema.

    +

    + An array instance is valid against "contains" if at least one of + its elements is valid against the given schema, + except when "minContains" is present and has a value of 0, in which + case an array instance MUST be considered valid against the "contains" keyword, + even if none of its elements is valid against the given schema.

    +

    + This keyword produces an annotation value which is an array of + the indexes to which this keyword validates successfully when applying + its subschema, in ascending order. The value MAY be a boolean "true" if + the subschema validates successfully when applied to every index of the + instance. The annotation MUST be present if the instance array to which + this keyword's schema applies is empty.

    +

    + This annotation affects the behavior of "unevaluatedItems" in the + Unevaluated vocabulary, and MAY also be used to implement the + "minContains" and "maxContains" keywords in the Validation vocabulary.

    +

    + The subschema MUST be applied to every array element even after the first + match has been found, in order to collect annotations for use by other + keywords. This is to ensure that all possible annotations are collected.

    +
    +
    +
    +

    +10.3.2. Keywords for Applying Subschemas to Objects +

    +
    +
    +10.3.2.1. properties +
    +

    + The value of "properties" MUST be an object. + Each value of this object MUST be a valid JSON Schema.

    +

    + Validation succeeds if, for each name that appears in both + the instance and as a name within this keyword's value, the child + instance for that name successfully validates against the + corresponding schema.

    +

    + The annotation result of this keyword is the set of instance + property names matched by this keyword. + This annotation affects the behavior of "additionalProperties" (in + this vocabulary) and "unevaluatedProperties" in the Unevaluated vocabulary.

    +

    + Omitting this keyword has the same assertion behavior as + an empty object.

    +
    +
    +
    +10.3.2.2. patternProperties +
    +

    + The value of "patternProperties" MUST be an object. Each property name + of this object SHOULD be a valid regular expression, according to the + ECMA-262 regular expression dialect. Each property value of this object + MUST be a valid JSON Schema.

    +

    + Validation succeeds if, for each instance name that matches any + regular expressions that appear as a property name in this keyword's value, + the child instance for that name successfully validates against each + schema that corresponds to a matching regular expression.

    +

    + The annotation result of this keyword is the set of instance + property names matched by this keyword. + This annotation affects the behavior of "additionalProperties" (in this + vocabulary) and "unevaluatedProperties" (in the Unevaluated vocabulary).

    +

    + Omitting this keyword has the same assertion behavior as + an empty object.

    +
    +
    +
    +
    +10.3.2.3. additionalProperties +
    +

    + The value of "additionalProperties" MUST be a valid JSON Schema.

    +

    + The behavior of this keyword depends on the presence and + annotation results of "properties" and "patternProperties" + within the same schema object. + Validation with "additionalProperties" applies only to the child + values of instance names that do not appear in the annotation + results of either "properties" or "patternProperties".

    +

    + For all such properties, validation succeeds if the child instance + validates against the "additionalProperties" schema.

    +

    + The annotation result of this keyword is the set of instance + property names validated by this keyword's subschema. + This annotation affects the behavior of "unevaluatedProperties" + in the Unevaluated vocabulary.

    +

    + Omitting this keyword has the same assertion behavior as + an empty schema.

    +

    + Implementations MAY choose to implement or optimize this keyword + in another way that produces the same effect, such as by directly + checking the names in "properties" and the patterns in + "patternProperties" against the instance property set. + Implementations that do not support annotation collection MUST do so. + + In defining this option, it seems there is the potential for + ambiguity in the output format. The ambiguity does not affect validation results, + but it does affect the resulting output format. + The ambiguity allows for multiple valid output results depending on whether annotations + are used or a solution that "produces the same effect" as draft-07. It is understood + that annotations from failing schemas are dropped. + See our + [Decision Record](https://github.com/json-schema-org/json-schema-spec/tree/HEAD/adr/2022-04-08-cref-for-ambiguity-and-fix-later-gh-spec-issue-1172.md) + for further details. +

    +
    +
    +
    +
    +10.3.2.4. propertyNames +
    +

    + The value of "propertyNames" MUST be a valid JSON Schema.

    +

    + If the instance is an object, this keyword validates if every property name in + the instance validates against the provided schema. + Note the property name that the schema is testing will always be a string.

    +

    + Omitting this keyword has the same behavior as an empty schema.

    +
    +
    +
    +
    +
    +

    +11. A Vocabulary for Unevaluated Locations +

    +

    + The purpose of these keywords is to enable schema authors to apply + subschemas to array items or object properties that have not been + successfully evaluated against any dynamic-scope subschema of any + adjacent keywords.

    +

    + These instance items or properties may have been unsuccessfully evaluated + against one or more adjacent keyword subschemas, such as when an assertion + in a branch of an "anyOf" fails. Such failed evaluations are not considered + to contribute to whether or not the item or property has been evaluated. + Only successful evaluations are considered.

    +

    + If an item in an array or an object property is "successfully evaluated", it + is logically considered to be valid in terms of the representation of the + object or array that's expected. For example if a subschema represents a car, + which requires between 2-4 wheels, and the value of "wheels" is 6, the instance + object is not "evaluated" to be a car, and the "wheels" property is considered + "unevaluated (successfully as a known thing)", and does not retain any annotations.

    +

    + Recall that adjacent keywords are keywords within the same schema object, + and that the dynamic-scope subschemas include reference targets as well as + lexical subschemas.

    +

    + The behavior of these keywords depend on the annotation results of + adjacent keywords that apply to the instance location being validated.

    +

    + Meta-schemas that do not use "$vocabulary" SHOULD be considered to + require this vocabulary as if its URI were present with a value of true.

    +

    + The current URI for this vocabulary, known as the Unevaluated Applicator + vocabulary, is: + <https://json-schema.org/draft/2020-12/vocab/unevaluated>.

    +

    + The current URI for the corresponding meta-schema is: + https://json-schema.org/draft/2020-12/meta/unevaluated.

    +
    +

    +11.1. Keyword Independence +

    +

    + Schema keywords typically operate independently, without + affecting each other's outcomes. However, the keywords in this + vocabulary are notable exceptions:

    +
      +
    • + "unevaluatedItems", whose behavior is defined in terms of annotations + from "prefixItems", "items", "contains", and itself +
    • +
    • + "unevaluatedProperties", whose behavior is defined in terms of + annotations from "properties", "patternProperties", + "additionalProperties" and itself +
    • +
    +
    +
    +
    +

    +11.2. unevaluatedItems +

    +

    + The value of "unevaluatedItems" MUST be a valid JSON Schema.

    +

    + The behavior of this keyword depends on the annotation results of + adjacent keywords that apply to the instance location being validated. + Specifically, the annotations from "prefixItems", "items", and "contains", + which can come from those keywords when they are adjacent to the + "unevaluatedItems" keyword. Those three annotations, as well as + "unevaluatedItems", can also result from any and all adjacent + in-place applicator (Section 10.2) keywords. + This includes but is not limited to the in-place applicators + defined in this document.

    +

    + If no relevant annotations are present, the "unevaluatedItems" + subschema MUST be applied to all locations in the array. + If a boolean true value is present from any of the relevant annotations, + "unevaluatedItems" MUST be ignored. Otherwise, the subschema + MUST be applied to any index greater than the largest annotation + value for "prefixItems", which does not appear in any annotation + value for "contains".

    +

    + This means that "prefixItems", "items", "contains", and all in-place + applicators MUST be evaluated before this keyword can be evaluated. + Authors of extension keywords MUST NOT define an in-place applicator + that would need to be evaluated after this keyword.

    +

    + If the "unevaluatedItems" subschema is applied to any + positions within the instance array, it produces an + annotation result of boolean true, analogous to the + behavior of "items". + This annotation affects the behavior of "unevaluatedItems" in parent schemas.

    +

    + Omitting this keyword has the same assertion behavior as + an empty schema.

    +
    +
    +
    +
    +

    +11.3. unevaluatedProperties +

    +

    + The value of "unevaluatedProperties" MUST be a valid JSON Schema.

    +

    + The behavior of this keyword depends on the annotation results of + adjacent keywords that apply to the instance location being validated. + Specifically, the annotations from "properties", "patternProperties", + and "additionalProperties", which can come from those keywords when + they are adjacent to the "unevaluatedProperties" keyword. Those + three annotations, as well as "unevaluatedProperties", can also + result from any and all adjacent + in-place applicator (Section 10.2) keywords. + This includes but is not limited to the in-place applicators + defined in this document.

    +

    + Validation with "unevaluatedProperties" applies only to the child + values of instance names that do not appear in the "properties", + "patternProperties", "additionalProperties", or + "unevaluatedProperties" annotation results that apply to the + instance location being validated.

    +

    + For all such properties, validation succeeds if the child instance + validates against the "unevaluatedProperties" schema.

    +

    + This means that "properties", "patternProperties", "additionalProperties", + and all in-place applicators MUST be evaluated before this keyword can + be evaluated. Authors of extension keywords MUST NOT define an in-place + applicator that would need to be evaluated after this keyword.

    +

    + The annotation result of this keyword is the set of instance + property names validated by this keyword's subschema. + This annotation affects the behavior of "unevaluatedProperties" in parent schemas.

    +

    + Omitting this keyword has the same assertion behavior as + an empty schema.

    +
    +
    +
    +
    +
    +

    +12. Output Formatting +

    +

    + JSON Schema is defined to be platform-independent. As such, to increase compatibility + across platforms, implementations SHOULD conform to a standard validation output + format. This section describes the minimum requirements that consumers will need to + properly interpret validation results.

    +
    +

    +12.1. Format +

    +

    + JSON Schema output is defined using the JSON Schema data instance model as described + in section 4.2.1. Implementations MAY deviate from this as supported by their + specific languages and platforms, however it is RECOMMENDED that the output be + convertible to the JSON format defined herein via serialization or other means.

    +
    +
    +

    +12.2. Output Formats +

    +

    + This specification defines four output formats. See the "Output Structure" + section for the requirements of each format.

    +
      +
    • + Flag - A boolean which simply indicates the overall validation result + with no further details. +
    • +
    • + Basic - Provides validation information in a flat list structure. +
    • +
    • + Detailed - Provides validation information in a condensed hierarchical + structure based on the structure of the schema. +
    • +
    • + Verbose - Provides validation information in an uncondensed hierarchical + structure that matches the exact structure of the schema. +
    • +
    +

    + An implementation SHOULD provide at least one of the "flag", "basic", or "detailed" + format and MAY provide the "verbose" format. If it provides one or more of the + "detailed" or "verbose" formats, it MUST also provide the "flag" format. + Implementations SHOULD specify in their documentation which formats they support.

    +
    +
    +

    +12.3. Minimum Information +

    +

    + Beyond the simplistic "flag" output, additional information is useful to aid in + debugging a schema or instance. Each sub-result SHOULD contain the information + contained within this section at a minimum.

    +

    + A single object that contains all of these components is considered an + output unit.

    +

    + Implementations MAY elect to provide additional information.

    +
    +

    +12.3.1. Keyword Relative Location +

    +

    + The relative location of the validating keyword that follows the validation + path. The value MUST be expressed as a JSON Pointer, and it MUST include + any by-reference applicators such as "$ref" or "$dynamicRef".

    +
    +
    +
    +/properties/width/$ref/minimum
    +
    +
    +
    +

    + Note that this pointer may not be resolvable by the normal JSON Pointer process + due to the inclusion of these by-reference applicator keywords.

    +

    + The JSON key for this information is "keywordLocation".

    +
    +
    +

    +12.3.2. Keyword Absolute Location +

    +

    + The absolute, dereferenced location of the validating keyword. The value MUST + be expressed as a full URI using the canonical URI of the relevant schema resource + with a JSON Pointer fragment, and it MUST NOT include by-reference applicators + such as "$ref" or "$dynamicRef" as non-terminal path components. + It MAY end in such keywords if the error or annotation is for that + keyword, such as an unresolvable reference. + + Note that "absolute" here is in the sense of "absolute filesystem path" + (meaning the complete location) rather than the "absolute-URI" + terminology from RFC 3986 (meaning with scheme but without fragment). + Keyword absolute locations will have a fragment in order to + identify the keyword. +

    +
    +
    +
    +https://example.com/schemas/common#/$defs/count/minimum
    +
    +
    +
    +

    + This information MAY be omitted only if either the dynamic scope did not pass + over a reference or if the schema does not declare an absolute URI as its "$id".

    +

    + The JSON key for this information is "absoluteKeywordLocation".

    +
    +
    +

    +12.3.3. Instance Location +

    +

    + The location of the JSON value within the instance being validated. The + value MUST be expressed as a JSON Pointer.

    +

    + The JSON key for this information is "instanceLocation".

    +
    +
    +

    +12.3.4. Error or Annotation +

    +

    + The error or annotation that is produced by the validation.

    +

    + For errors, the specific wording for the message is not defined by this + specification. Implementations will need to provide this.

    +

    + For annotations, each keyword that produces an annotation specifies its + format. By default, it is the keyword's value.

    +

    + The JSON key for failed validations is "error"; for successful validations + it is "annotation".

    +
    +
    +

    +12.3.5. Nested Results +

    +

    + For the two hierarchical structures, this property will hold nested errors + and annotations.

    +

    + The JSON key for nested results in failed validations is "errors"; for + successful validations it is "annotations". Note the plural forms, as + a keyword with nested results can also have a local error or annotation.

    +
    +
    +
    +

    +12.4. Output Structure +

    +

    + The output MUST be an object containing a boolean property named "valid". When + additional information about the result is required, the output MUST also contain + "errors" or "annotations" as described below.

    +
      +
    • + "valid" - a boolean value indicating the overall validation success or + failure +
    • +
    • + "errors" - the collection of errors or annotations produced by a failed + validation +
    • +
    • + "annotations" - the collection of errors or annotations produced by a + successful validation +
    • +
    +

    + For these examples, the following schema and instance will be used.

    +
    +
    +
    +{
    +  "$id": "https://example.com/polygon",
    +  "$schema": "https://json-schema.org/draft/2020-12/schema",
    +  "$defs": {
    +    "point": {
    +      "type": "object",
    +      "properties": {
    +        "x": { "type": "number" },
    +        "y": { "type": "number" }
    +      },
    +      "additionalProperties": false,
    +      "required": [ "x", "y" ]
    +    }
    +  },
    +  "type": "array",
    +  "items": { "$ref": "#/$defs/point" },
    +  "minItems": 3
    +}
    +
    +[
    +  {
    +    "x": 2.5,
    +    "y": 1.3
    +  },
    +  {
    +    "x": 1,
    +    "z": 6.7
    +  }
    +]
    +
    +
    +
    +

    + This instance will fail validation and produce errors, but it's trivial to deduce + examples for passing schemas that produce annotations.

    +

    + Specifically, the errors it will produce are:

    +
      +
    • + The second object is missing a "y" property. +
    • +
    • + The second object has a disallowed "z" property. +
    • +
    • + There are only two objects, but three are required. +
    • +
    +

    + Note that the error message wording as depicted in these examples is not a + requirement of this specification. Implementations SHOULD craft error messages + tailored for their audience or provide a templating mechanism that allows their + users to craft their own messages.

    +
    +

    +12.4.1. Flag +

    +

    + In the simplest case, merely the boolean result for the "valid" valid property + needs to be fulfilled.

    +
    +
    +
    +{
    +  "valid": false
    +}
    +
    +
    +
    +

    + Because no errors or annotations are returned with this format, it is + RECOMMENDED that implementations use short-circuiting logic to return + failure or success as soon as the outcome can be determined. For example, + if an "anyOf" keyword contains five sub-schemas, and the second one + passes, there is no need to check the other three. The logic can simply + return with success.

    +
    +
    +

    +12.4.2. Basic +

    +

    + The "Basic" structure is a flat list of output units.

    +
    +
    +
    +{
    +  "valid": false,
    +  "errors": [
    +    {
    +      "keywordLocation": "",
    +      "instanceLocation": "",
    +      "error": "A subschema had errors."
    +    },
    +    {
    +      "keywordLocation": "/items/$ref",
    +      "absoluteKeywordLocation":
    +        "https://example.com/polygon#/$defs/point",
    +      "instanceLocation": "/1",
    +      "error": "A subschema had errors."
    +    },
    +    {
    +      "keywordLocation": "/items/$ref/required",
    +      "absoluteKeywordLocation":
    +        "https://example.com/polygon#/$defs/point/required",
    +      "instanceLocation": "/1",
    +      "error": "Required property 'y' not found."
    +    },
    +    {
    +      "keywordLocation": "/items/$ref/additionalProperties",
    +      "absoluteKeywordLocation":
    +        "https://example.com/polygon#/$defs/point/additionalProperties",
    +      "instanceLocation": "/1/z",
    +      "error": "Additional property 'z' found but was invalid."
    +    },
    +    {
    +      "keywordLocation": "/minItems",
    +      "instanceLocation": "",
    +      "error": "Expected at least 3 items but found 2"
    +    }
    +  ]
    +}
    +
    +
    +
    +
    +
    +

    +12.4.3. Detailed +

    +

    + The "Detailed" structure is based on the schema and can be more readable + for both humans and machines. Having the structure organized this way makes + associations between the errors more apparent. For example, the fact that + the missing "y" property and the extra "z" property both stem from the same + location in the instance is not immediately obvious in the "Basic" structure. + In a hierarchy, the correlation is more easily identified.

    +

    + The following rules govern the construction of the results object:

    +
      +
    • + All applicator keywords ("*Of", "$ref", "if"/"then"/"else", etc.) require + a node. +
    • +
    • + Nodes that have no children are removed. +
    • +
    • + Nodes that have a single child are replaced by the child. +
    • +
    +

    + Branch nodes do not require an error message or an annotation.

    +
    +
    +
    +{
    +  "valid": false,
    +  "keywordLocation": "",
    +  "instanceLocation": "",
    +  "errors": [
    +    {
    +      "valid": false,
    +      "keywordLocation": "/items/$ref",
    +      "absoluteKeywordLocation":
    +        "https://example.com/polygon#/$defs/point",
    +      "instanceLocation": "/1",
    +      "errors": [
    +        {
    +          "valid": false,
    +          "keywordLocation": "/items/$ref/required",
    +          "absoluteKeywordLocation":
    +            "https://example.com/polygon#/$defs/point/required",
    +          "instanceLocation": "/1",
    +          "error": "Required property 'y' not found."
    +        },
    +        {
    +          "valid": false,
    +          "keywordLocation": "/items/$ref/additionalProperties",
    +          "absoluteKeywordLocation":
    +            "https://example.com/polygon#/$defs/point/additionalProperties",
    +          "instanceLocation": "/1/z",
    +          "error": "Additional property 'z' found but was invalid."
    +        }
    +      ]
    +    },
    +    {
    +      "valid": false,
    +      "keywordLocation": "/minItems",
    +      "instanceLocation": "",
    +      "error": "Expected at least 3 items but found 2"
    +    }
    +  ]
    +}
    +
    +
    +
    +
    +
    +

    +12.4.4. Verbose +

    +

    + The "Verbose" structure is a fully realized hierarchy that exactly matches + that of the schema. This structure has applications in form generation and + validation where the error's location is important.

    +

    + The primary difference between this and the "Detailed" structure is that + all results are returned. This includes sub-schema validation results that + would otherwise be removed (e.g. annotations for failed validations, + successful validations inside a `not` keyword, etc.). Because of this, it + is RECOMMENDED that each node also carry a `valid` property to indicate the + validation result for that node.

    +

    + Because this output structure can be quite large, a smaller example is given + here for brevity. The URI of the full output structure of the example above is: + https://json-schema.org/draft/2020-12/output/verbose-example.

    +
    +
    +
    +// schema
    +{
    +  "$id": "https://example.com/polygon",
    +  "$schema": "https://json-schema.org/draft/2020-12/schema",
    +  "type": "object",
    +  "properties": {
    +    "validProp": true,
    +  },
    +  "additionalProperties": false
    +}
    +
    +// instance
    +{
    +  "validProp": 5,
    +  "disallowedProp": "value"
    +}
    +
    +// result
    +{
    +  "valid": false,
    +  "keywordLocation": "",
    +  "instanceLocation": "",
    +  "errors": [
    +    {
    +      "valid": true,
    +      "keywordLocation": "/type",
    +      "instanceLocation": ""
    +    },
    +    {
    +      "valid": true,
    +      "keywordLocation": "/properties",
    +      "instanceLocation": ""
    +    },
    +    {
    +      "valid": false,
    +      "keywordLocation": "/additionalProperties",
    +      "instanceLocation": "",
    +      "errors": [
    +        {
    +          "valid": false,
    +          "keywordLocation": "/additionalProperties",
    +          "instanceLocation": "/disallowedProp",
    +          "error": "Additional property 'disallowedProp' found but was invalid."
    +        }
    +      ]
    +    }
    +  ]
    +}
    +
    +
    +
    +
    +
    +

    +12.4.5. Output validation schemas +

    +

    + For convenience, JSON Schema has been provided to validate output generated + by implementations. Its URI is: + https://json-schema.org/draft/2020-12/output/schema.

    +
    +
    +
    +
    +
    +
    +

    +13. Security Considerations +

    +

    + Both schemas and instances are JSON values. As such, all security considerations + defined in RFC 8259 [RFC8259] apply.

    +

    + Instances and schemas are both frequently written by untrusted third parties, to be + deployed on public Internet servers. + Validators should take care that the parsing and validating against schemas does not consume excessive + system resources. + Validators MUST NOT fall into an infinite loop.

    +

    + A malicious party could cause an implementation to repeatedly collect a copy + of a very large value as an annotation. Implementations SHOULD guard against + excessive consumption of system resources in such a scenario.

    +

    + Servers MUST ensure that malicious parties cannot change the functionality of + existing schemas by uploading a schema with a pre-existing or very similar "$id".

    +

    + Individual JSON Schema vocabularies are liable to also have their own security + considerations. Consult the respective specifications for more information.

    +

    + Schema authors should take care with "$comment" contents, as a malicious + implementation can display them to end-users in violation of a spec, or + fail to strip them if such behavior is expected.

    +

    + A malicious schema author could place executable code or other dangerous + material within a "$comment". Implementations MUST NOT parse or otherwise + take action based on "$comment" contents.

    +
    +
    +
    +

    +14. IANA Considerations +

    +
    +

    +14.1. application/schema+json +

    +

    + The proposed MIME media type for JSON Schema is defined as follows:

    +
      +
    • Type name: application +
    • +
    • Subtype name: schema+json +
    • +
    • Required parameters: N/A +
    • +
    • + Encoding considerations: Encoding considerations are + identical to those specified for the "application/json" + media type. See JSON [RFC8259]. +
    • +
    • + Security considerations: See Section + 13 above. +
    • +
    • + Interoperability considerations: See Sections + 6.2, + 6.3, and + 6.4 above. +
    • +
    • + Fragment identifier considerations: See Section + 5 +
    • +
    +
    +
    +

    +14.2. application/schema-instance+json +

    +

    + The proposed MIME media type for JSON Schema Instances that require + a JSON Schema-specific media type is defined as follows:

    +
      +
    • Type name: application +
    • +
    • Subtype name: schema-instance+json +
    • +
    • Required parameters: N/A +
    • +
    • + Encoding considerations: Encoding considerations are + identical to those specified for the "application/json" + media type. See JSON [RFC8259]. +
    • +
    • + Security considerations: See Section + 13 above. +
    • +
    • + Interoperability considerations: See Sections + 6.2, + 6.3, and + 6.4 above. +
    • +
    • + Fragment identifier considerations: See Section + 5 +
    • +
    +
    +
    +
    +

    +15. References +

    +
    +

    +15.1. Normative References +

    +
    +
    [RFC2119]
    +
    +Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/info/rfc2119>.
    +
    +
    [RFC3986]
    +
    +Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, DOI 10.17487/RFC3986, , <https://www.rfc-editor.org/info/rfc3986>.
    +
    +
    [RFC6839]
    +
    +Hansen, T. and A. Melnikov, "Additional Media Type Structured Syntax Suffixes", RFC 6839, DOI 10.17487/RFC6839, , <https://www.rfc-editor.org/info/rfc6839>.
    +
    +
    [RFC6901]
    +
    +Bryan, P., Ed., Zyp, K., and M. Nottingham, Ed., "JavaScript Object Notation (JSON) Pointer", RFC 6901, DOI 10.17487/RFC6901, , <https://www.rfc-editor.org/info/rfc6901>.
    +
    +
    [RFC8259]
    +
    +Bray, T., Ed., "The JavaScript Object Notation (JSON) Data Interchange Format", STD 90, RFC 8259, DOI 10.17487/RFC8259, , <https://www.rfc-editor.org/info/rfc8259>.
    +
    +
    [W3C.REC-ldp-20150226]
    +
    +Speicher, S., Arwe, J., and A. Malhotra, "Linked Data Platform 1.0", World Wide Web Consortium Recommendation REC-ldp-20150226, , <https://www.w3.org/TR/2015/REC-ldp-20150226>.
    +
    +
    [ecma262]
    +
    +"ECMA-262, 11th edition specification", , <https://www.ecma-international.org/ecma-262/11.0/index.html>.
    +
    +
    +
    +
    +

    +15.2. Informative References +

    +
    +
    [RFC6596]
    +
    +Ohye, M. and J. Kupke, "The Canonical Link Relation", RFC 6596, DOI 10.17487/RFC6596, , <https://www.rfc-editor.org/info/rfc6596>.
    +
    +
    [RFC7049]
    +
    +Bormann, C. and P. Hoffman, "Concise Binary Object Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, , <https://www.rfc-editor.org/info/rfc7049>.
    +
    +
    [RFC7231]
    +
    +Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content", RFC 7231, DOI 10.17487/RFC7231, , <https://www.rfc-editor.org/info/rfc7231>.
    +
    +
    [RFC8288]
    +
    +Nottingham, M., "Web Linking", RFC 8288, DOI 10.17487/RFC8288, , <https://www.rfc-editor.org/info/rfc8288>.
    +
    +
    [W3C.WD-fragid-best-practices-20121025]
    +
    +Tennison, J., "Best Practices for Fragment Identifiers and Media Type Definitions", World Wide Web Consortium WD WD-fragid-best-practices-20121025, , <https://www.w3.org/TR/2012/WD-fragid-best-practices-20121025>.
    +
    +
    [json-schema-validation]
    +
    +Wright, A., Andrews, H., and B. Hutton, "JSON Schema Validation: A Vocabulary for Structural Validation of JSON", Work in Progress, Internet-Draft, draft-bhutton-json-schema-validation-01, , <https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-01>.
    +
    +
    [json-hyper-schema]
    +
    +Andrews, H. and A. Wright, "JSON Hyper-Schema: A Vocabulary for Hypermedia Annotation of JSON", Work in Progress, Internet-Draft, draft-handrews-json-schema-hyperschema-02, , <https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-hyperschema-02>.
    +
    +
    [xml-names]
    +
    +Bray, T., Ed., Hollander, D., Ed., Layman, A., Ed., and R. Tobin, Ed., "Namespaces in XML 1.1 (Second Edition)", , <http://www.w3.org/TR/2006/REC-xml-names11-20060816>.
    +
    +
    +
    +
    +
    +
    +

    +Appendix A. Schema identification examples +

    +

    + Consider the following schema, which shows "$id" being used to identify + both the root schema and various subschemas, and "$anchor" being used + to define plain name fragment identifiers.

    +
    +
    +
    +{
    +    "$id": "https://example.com/root.json",
    +    "$defs": {
    +        "A": { "$anchor": "foo" },
    +        "B": {
    +            "$id": "other.json",
    +            "$defs": {
    +                "X": { "$anchor": "bar" },
    +                "Y": {
    +                    "$id": "t/inner.json",
    +                    "$anchor": "bar"
    +                }
    +            }
    +        },
    +        "C": {
    +            "$id": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f"
    +        }
    +    }
    +}
    +
    +
    +
    +

    + The schemas at the following URI-encoded JSON + Pointers [RFC6901] (relative to the root schema) have the following + base URIs, and are identifiable by any listed URI in accordance with + sections 5 and + 9.2.1 above.

    +
    +
    # (document root)
    +
    +
    +
    canonical (and base) URI
    +
    + https://example.com/root.json +
    +
    +
    canonical resource URI plus pointer fragment
    +
    + https://example.com/root.json# +
    +
    +
    +
    +
    +
    #/$defs/A
    +
    +
    +
    base URI
    +
    https://example.com/root.json +
    +
    +
    canonical resource URI plus plain fragment
    +
    + https://example.com/root.json#foo +
    +
    +
    canonical resource URI plus pointer fragment
    +
    + https://example.com/root.json#/$defs/A +
    +
    +
    +
    +
    +
    #/$defs/B
    +
    +
    +
    canonical (and base) URI
    +
    https://example.com/other.json +
    +
    +
    canonical resource URI plus pointer fragment
    +
    + https://example.com/other.json# +
    +
    +
    base URI of enclosing (root.json) resource plus fragment
    +
    + https://example.com/root.json#/$defs/B +
    +
    +
    +
    +
    +
    #/$defs/B/$defs/X
    +
    +
    +
    base URI
    +
    https://example.com/other.json +
    +
    +
    canonical resource URI plus plain fragment
    +
    + https://example.com/other.json#bar +
    +
    +
    canonical resource URI plus pointer fragment
    +
    + https://example.com/other.json#/$defs/X +
    +
    +
    base URI of enclosing (root.json) resource plus fragment
    +
    + https://example.com/root.json#/$defs/B/$defs/X +
    +
    +
    +
    +
    +
    #/$defs/B/$defs/Y
    +
    +
    +
    canonical (and base) URI
    +
    https://example.com/t/inner.json +
    +
    +
    canonical URI plus plain fragment
    +
    + https://example.com/t/inner.json#bar +
    +
    +
    canonical URI plus pointer fragment
    +
    + https://example.com/t/inner.json# +
    +
    +
    base URI of enclosing (other.json) resource plus fragment
    +
    + https://example.com/other.json#/$defs/Y +
    +
    +
    base URI of enclosing (root.json) resource plus fragment
    +
    + https://example.com/root.json#/$defs/B/$defs/Y +
    +
    +
    +
    +
    +
    #/$defs/C
    +
    +
    +
    canonical (and base) URI
    +
    + urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f +
    +
    +
    canonical URI plus pointer fragment
    +
    + urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f# +
    +
    +
    base URI of enclosing (root.json) resource plus fragment
    +
    + https://example.com/root.json#/$defs/C +
    +
    +
    +
    +
    +
    +

    + Note: The fragment part of the URI does not make it canonical or non-canonical, + rather, the base URI used (as part of the full URI with any fragment) is what + determines the canonical nature of the resulting full URI. + + Multiple "canonical" URIs? We Acknowledge this is potentially confusing, and + direct you to read the CREF located in the + JSON Pointer fragments and embedded schema resources (Section 9.2.1) + section for futher comments. +

    +
    +
    +
    +

    +Appendix B. Manipulating schema documents and references +

    +

    + Various tools have been created to rearrange schema documents + based on how and where references ("$ref") appear. This appendix discusses + which use cases and actions are compliant with this specification.

    +
    +

    +B.1. Bundling schema resources into a single document +

    +

    + A set of schema resources intended for use together can be organized + with each in its own schema document, all in the same schema document, + or any granularity of document grouping in between.

    +

    + Numerous tools exist to perform various sorts of reference removal. + A common case of this is producing a single file where all references + can be resolved within that file. This is typically done to simplify + distribution, or to simplify coding so that various invocations + of JSON Schema libraries do not have to keep track of and load + a large number of resources.

    +

    + This transformation can be safely and reversibly done as long as + all static references (e.g. "$ref") use URI-references that resolve + to URIs using the canonical resource URI as the base, and all schema + resources have an absolute-URI as the "$id" in their root schema.

    +

    + With these conditions met, each external resource can be copied + under "$defs", without breaking any references among the resources' + schema objects, and without changing any aspect of validation or + annotation results. The names of the schemas under "$defs" do + not affect behavior, assuming they are each unique, as they + do not appear in the canonical URIs for the embedded resources.

    +
    +
    +

    +B.2. Reference removal is not always safe +

    +

    + Attempting to remove all references and produce a single schema document does not, + in all cases, produce a schema with identical behavior to the original form.

    +

    + Since "$ref" is now treated like any other keyword, with other keywords allowed + in the same schema objects, fully supporting non-recursive "$ref" removal in + all cases can require relatively complex schema manipulations. It is beyond + the scope of this specification to determine or provide a set of safe "$ref" + removal transformations, as they depend not only on the schema structure + but also on the intended usage.

    +
    +
    +
    +
    +

    +Appendix C. Example of recursive schema extension +

    +

    + Consider the following two schemas describing a simple + recursive tree structure, where each node in the tree + can have a "data" field of any type. The first schema + allows and ignores other instance properties. The second is + more strict and only allows the "data" and "children" properties. + An example instance with "data" misspelled as "daat" is also shown.

    +
    +
    +
    +// tree schema, extensible
    +{
    +    "$schema": "https://json-schema.org/draft/2020-12/schema",
    +    "$id": "https://example.com/tree",
    +    "$dynamicAnchor": "node",
    +
    +    "type": "object",
    +    "properties": {
    +        "data": true,
    +        "children": {
    +            "type": "array",
    +            "items": {
    +                "$dynamicRef": "#node"
    +            }
    +        }
    +    }
    +}
    +
    +// strict-tree schema, guards against misspelled properties
    +{
    +    "$schema": "https://json-schema.org/draft/2020-12/schema",
    +    "$id": "https://example.com/strict-tree",
    +    "$dynamicAnchor": "node",
    +
    +    "$ref": "tree",
    +    "unevaluatedProperties": false
    +}
    +
    +// instance with misspelled field
    +{
    +    "children": [ { "daat": 1 } ]
    +}
    +
    +
    +
    +

    + When we load these two schemas, we will notice the "$dynamicAnchor" + named "node" (note the lack of "#" as this is just the name) + present in each, resulting in the following full schema URIs:

    +
      +
    • "https://example.com/tree#node" +
    • +
    • "https://example.com/strict-tree#node" +
    • +
    +

    + In addition, JSON Schema implementations keep track of the fact + that these fragments were created with "$dynamicAnchor".

    +

    + If we apply the "strict-tree" schema to the instance, we will follow + the "$ref" to the "tree" schema, examine its "children" subschema, + and find the "$dynamicRef": to "#node" (note the "#" for URI fragment syntax) + in its "items" subschema. That reference resolves to + "https://example.com/tree#node", which is a URI with a fragment + created by "$dynamicAnchor". Therefore we must examine the dynamic + scope before following the reference.

    +

    + At this point, the dynamic path is + "#/$ref/properties/children/items/$dynamicRef", with a dynamic scope + containing (from the outermost scope to the innermost):

    +
      +
    1. "https://example.com/strict-tree#" +
    2. +
    3. "https://example.com/tree#" +
    4. +
    5. "https://example.com/tree#/properties/children" +
    6. +
    7. "https://example.com/tree#/properties/children/items" +
    8. +
    +

    + Since we are looking for a plain name fragment, which can be + defined anywhere within a schema resource, the JSON Pointer fragments + are irrelevant to this check. That means that we can remove those + fragments and eliminate consecutive duplicates, producing:

    +
      +
    1. "https://example.com/strict-tree" +
    2. +
    3. "https://example.com/tree" +
    4. +
    +

    + In this case, the outermost resource also has a "node" fragment + defined by "$dynamicAnchor". Therefore instead of resolving the + "$dynamicRef" to "https://example.com/tree#node", we resolve it to + "https://example.com/strict-tree#node".

    +

    + This way, the recursion in the "tree" schema recurses to the root + of "strict-tree", instead of only applying "strict-tree" to the + instance root, but applying "tree" to instance children.

    +

    + This example shows both "$dynamicAnchor"s in the same place + in each schema, specifically the resource root schema. + Since plain-name fragments are independent of the JSON structure, + this would work just as well if one or both of the node schema objects + were moved under "$defs". It is the matching "$dynamicAnchor" values + which tell us how to resolve the dynamic reference, not any sort of + correlation in JSON structure.

    +
    +
    +
    +

    +Appendix D. Working with vocabularies +

    +
    +

    +D.1. Best practices for vocabulary and meta-schema authors +

    +

    + Vocabulary authors should + take care to avoid keyword name collisions if the vocabulary is intended + for broad use, and potentially combined with other vocabularies. JSON + Schema does not provide any formal namespacing system, but also does + not constrain keyword names, allowing for any number of namespacing + approaches.

    +

    + Vocabularies may build on each other, such as by defining the behavior + of their keywords with respect to the behavior of keywords from another + vocabulary, or by using a keyword from another vocabulary with + a restricted or expanded set of acceptable values. Not all such + vocabulary re-use will result in a new vocabulary that is compatible + with the vocabulary on which it is built. Vocabulary authors should + clearly document what level of compatibility, if any, is expected.

    +

    + Meta-schema authors should not use "$vocabulary" to combine multiple + vocabularies that define conflicting syntax or semantics for the same + keyword. As semantic conflicts are not generally detectable through + schema validation, implementations are not expected to detect such + conflicts. If conflicting vocabularies are declared, the resulting + behavior is undefined.

    +

    + Vocabulary authors SHOULD provide a meta-schema that validates the + expected usage of the vocabulary's keywords on their own. Such meta-schemas + SHOULD not forbid additional keywords, and MUST not forbid any + keywords from the Core vocabulary.

    +

    + It is recommended that meta-schema authors reference each vocabulary's + meta-schema using the "allOf" (Section 10.2.1.1) keyword, + although other mechanisms for constructing the meta-schema may be + appropriate for certain use cases.

    +

    + The recursive nature of meta-schemas makes the "$dynamicAnchor" + and "$dynamicRef" keywords particularly useful for extending + existing meta-schemas, as can be seen in the JSON Hyper-Schema meta-schema + which extends the Validation meta-schema.

    +

    + Meta-schemas may impose additional constraints, including describing + keywords not present in any vocabulary, beyond what the meta-schemas + associated with the declared vocabularies describe. This allows for + restricting usage to a subset of a vocabulary, and for validating + locally defined keywords not intended for re-use.

    +

    + However, meta-schemas should not contradict any vocabularies that + they declare, such as by requiring a different JSON type than + the vocabulary expects. The resulting behavior is undefined.

    +

    + Meta-schemas intended for local use, with no need to test for + vocabulary support in arbitrary implementations, can safely omit + "$vocabulary" entirely.

    +
    +
    +
    +

    +D.2. Example meta-schema with vocabulary declarations +

    +

    + This meta-schema explicitly declares both the Core and Applicator vocabularies, + together with an extension vocabulary, and combines their meta-schemas with + an "allOf". The extension vocabulary's meta-schema, which describes only the + keywords in that vocabulary, is shown after the main example meta-schema.

    +

    + The main example meta-schema also restricts the usage of the Unevaluated + vocabulary by forbidding the keywords prefixed with "unevaluated", which + are particularly complex to implement. This does not change the semantics + or set of keywords defined by the other vocabularies. It just ensures + that schemas using this meta-schema that attempt to use the keywords + prefixed with "unevaluated" will fail validation against this meta-schema.

    +

    + Finally, this meta-schema describes the syntax of a keyword, "localKeyword", + that is not part of any vocabulary. Presumably, the implementors and users + of this meta-schema will understand the semantics of "localKeyword". + JSON Schema does not define any mechanism for expressing keyword semantics + outside of vocabularies, making them unsuitable for use except in a + specific environment in which they are understood.

    +

    + This meta-schema combines several vocabularies for general use.

    +
    +
    +
    +{
    +  "$schema": "https://json-schema.org/draft/2020-12/schema",
    +  "$id": "https://example.com/meta/general-use-example",
    +  "$dynamicAnchor": "meta",
    +  "$vocabulary": {
    +    "https://json-schema.org/draft/2020-12/vocab/core": true,
    +    "https://json-schema.org/draft/2020-12/vocab/applicator": true,
    +    "https://json-schema.org/draft/2020-12/vocab/validation": true,
    +    "https://example.com/vocab/example-vocab": true
    +  },
    +  "allOf": [
    +    {"$ref": "https://json-schema.org/draft/2020-12/meta/core"},
    +    {"$ref": "https://json-schema.org/draft/2020-12/meta/applicator"},
    +    {"$ref": "https://json-schema.org/draft/2020-12/meta/validation"},
    +    {"$ref": "https://example.com/meta/example-vocab"}
    +  ],
    +  "patternProperties": {
    +    "^unevaluated": false
    +  },
    +  "properties": {
    +    "localKeyword": {
    +      "$comment": "Not in vocabulary, but validated if used",
    +      "type": "string"
    +    }
    +  }
    +}
    +
    +
    +
    +

    + This meta-schema describes only a single extension vocabulary.

    +
    +
    +
    +{
    +  "$schema": "https://json-schema.org/draft/2020-12/schema",
    +  "$id": "https://example.com/meta/example-vocab",
    +  "$dynamicAnchor": "meta",
    +  "$vocabulary": {
    +    "https://example.com/vocab/example-vocab": true,
    +  },
    +  "type": ["object", "boolean"],
    +  "properties": {
    +    "minDate": {
    +      "type": "string",
    +      "pattern": "\d\d\d\d-\d\d-\d\d",
    +      "format": "date",
    +    }
    +  }
    +}
    +
    +
    +
    +

    + As shown above, even though each of the single-vocabulary meta-schemas + referenced in the general-use meta-schema's "allOf" declares its + corresponding vocabulary, this new meta-schema must re-declare them.

    +

    + The standard meta-schemas that combine all vocabularies defined by + the Core and Validation specification, and that combine all vocabularies + defined by those specifications as well as the Hyper-Schema specification, + demonstrate additional complex combinations. These URIs for these + meta-schemas may be found in the Validation and Hyper-Schema specifications, + respectively.

    +

    + While the general-use meta-schema can validate the syntax of "minDate", + it is the vocabulary that defines the logic behind the semantic meaning + of "minDate". Without an understanding of the semantics (in this example, + that the instance value must be a date equal to or after the date + provided as the keyword's value in the schema), an implementation can + only validate the syntactic usage. In this case, that means validating + that it is a date-formatted string (using "pattern" to ensure that it is + validated even when "format" functions purely as an annotation, as explained + in the Validation specification [json-schema-validation].

    +
    +
    +
    +
    +

    +Appendix E. References and generative use cases +

    +

    + While the presence of references is expected to be transparent + to validation results, generative use cases such as code generators + and UI renderers often consider references to be semantically significant.

    +

    + To make such use case-specific semantics explicit, the best practice + is to create an annotation keyword for use in the same + schema object alongside of a reference keyword such as "$ref".

    +

    + For example, here is a hypothetical keyword for determining + whether a code generator should consider the reference + target to be a distinct class, and how those classes are related. + Note that this example is solely for illustrative purposes, and is + not intended to propose a functional code generation keyword.

    +
    +
    +
    +{
    +    "allOf": [
    +        {
    +            "classRelation": "is-a",
    +            "$ref": "classes/base.json"
    +        },
    +        {
    +            "$ref": "fields/common.json"
    +        }
    +    ],
    +    "properties": {
    +        "foo": {
    +            "classRelation": "has-a",
    +            "$ref": "classes/foo.json"
    +        },
    +        "date": {
    +            "$ref": "types/dateStruct.json",
    +        }
    +    }
    +}
    +
    +
    +
    +

    + Here, this schema represents some sort of object-oriented class. + The first reference in the "allOf" is noted as the base class. + The second is not assigned a class relationship, meaning that the + code generator should combine the target's definition with this + one as if no reference were involved.

    +

    + Looking at the properties, "foo" is flagged as object composition, + while the "date" property is not. It is simply a field with + sub-fields, rather than an instance of a distinct class.

    +

    + This style of usage requires the annotation to be in the same object + as the reference, which must be recognizable as a reference.

    +
    +
    +

    +Appendix F. Acknowledgments +

    +

    + Thanks to + Gary Court, + Francis Galiegue, + Kris Zyp, + and Geraint Luff + for their work on the initial drafts of JSON Schema.

    +

    + Thanks to + Jason Desrosiers, + Daniel Perrett, + Erik Wilde, + Evgeny Poberezkin, + Brad Bowman, + Gowry Sankar, + Donald Pipowitch, + Dave Finlay, + Denis Laxalde, + Phil Sturgeon, + Shawn Silverman, + and Karen Etheridge + for their submissions and patches to the document.

    +
    +
    +

    +Appendix G. ChangeLog +

    +

    + This section to be removed before leaving Internet-Draft status.

    +
    +
    draft-bhutton-json-schema-00
    +
    +
      +
    • "$schema" MAY change for embedded resources +
    • +
    • Array-value "items" functionality is now "prefixItems" +
    • +
    • "items" subsumes the old function of "additionalItems" +
    • +
    • "contains" annotation behavior, and "contains" and "unevaluatedItems" interactions now specified +
    • +
    • Rename $recursive* to $dynamic*, with behavior modification +
    • +
    • $dynamicAnchor defines a fragment like $anchor +
    • +
    • $dynamic* (previously $recursive) no longer use runtime base URI determination +
    • +
    • Define Compound Schema Documents (bundle) and processing +
    • +
    • Reference ECMA-262, 11th edition for regular expression support +
    • +
    • Regular expression should support unicode +
    • +
    • Remove media type parameters +
    • +
    • Specify Unknown keywords are collected as annotations +
    • +
    • Moved "unevaluatedItems" and "unevaluatedProperties" from core into their own vocabulary +
    • +
    +
    +
    +
    draft-handrews-json-schema-02
    +
    +
      +
    • Update to RFC 8259 for JSON specification +
    • +
    • Moved "definitions" from the Validation specification here as "$defs" +
    • +
    • Moved applicator keywords from the Validation specification as their own vocabulary +
    • +
    • Moved the schema form of "dependencies" from the Validation specification as "dependentSchemas" +
    • +
    • Formalized annotation collection +
    • +
    • Specified recommended output formats +
    • +
    • Defined keyword interactions in terms of annotation and assertion results +
    • +
    • Added "unevaluatedProperties" and "unevaluatedItems" +
    • +
    • Define "$ref" behavior in terms of the assertion, applicator, and annotation model +
    • +
    • Allow keywords adjacent to "$ref" +
    • +
    • Note undefined behavior for "$ref" targets involving unknown keywords +
    • +
    • Add recursive referencing, primarily for meta-schema extension +
    • +
    • Add the concept of formal vocabularies, and how they can be recognized through meta-schemas +
    • +
    • Additional guidance on initial base URIs beyond network retrieval +
    • +
    • Allow "schema" media type parameter for "application/schema+json" +
    • +
    • Better explanation of media type parameters and the HTTP Accept header +
    • +
    • Use "$id" to establish canonical and base absolute-URIs only, no fragments +
    • +
    • Replace plain-name-fragment-only form of "$id" with "$anchor" +
    • +
    • Clarified that the behavior of JSON Pointers across "$id" boundary is unreliable +
    • +
    +
    +
    +
    draft-handrews-json-schema-01
    +
    +
      +
    • This draft is purely a clarification with no functional changes +
    • +
    • Emphasized annotations as a primary usage of JSON Schema +
    • +
    • Clarified $id by use cases +
    • +
    • Exhaustive schema identification examples +
    • +
    • Replaced "external referencing" with how and when an implementation might know of a schema from another document +
    • +
    • Replaced "internal referencing" with how an implementation should recognized schema identifiers during parsing +
    • +
    • Dereferencing the former "internal" or "external" references is always the same process +
    • +
    • Minor formatting improvements +
    • +
    +
    +
    +
    draft-handrews-json-schema-00
    +
    +
      +
    • Make the concept of a schema keyword vocabulary more clear +
    • +
    • Note that the concept of "integer" is from a vocabulary, not the data model +
    • +
    • Classify keywords as assertions or annotations and describe their general behavior +
    • +
    • Explain the boolean schemas in terms of generalized assertions +
    • +
    • Reserve "$comment" for non-user-visible notes about the schema +
    • +
    • Wording improvements around "$id" and fragments +
    • +
    • Note the challenges of extending meta-schemas with recursive references +
    • +
    • Add "application/schema-instance+json" media type +
    • +
    • Recommend a "schema" link relation / parameter instead of "profile" +
    • +
    +
    +
    +
    draft-wright-json-schema-01
    +
    +
      +
    • Updated intro +
    • +
    • Allowed for any schema to be a boolean +
    • +
    • "$schema" SHOULD NOT appear in subschemas, although that may change +
    • +
    • Changed "id" to "$id"; all core keywords prefixed with "$" +
    • +
    • Clarify and formalize fragments for application/schema+json +
    • +
    • Note applicability to formats such as CBOR that can be represented in the JSON data model +
    • +
    +
    +
    +
    draft-wright-json-schema-00
    +
    +
      +
    • Updated references to JSON +
    • +
    • Updated references to HTTP +
    • +
    • Updated references to JSON Pointer +
    • +
    • Behavior for "id" is now specified in terms of RFC3986 +
    • +
    • Aligned vocabulary usage for URIs with RFC3986 +
    • +
    • Removed reference to draft-pbryan-zyp-json-ref-03 +
    • +
    • Limited use of "$ref" to wherever a schema is expected +
    • +
    • Added definition of the "JSON Schema data model" +
    • +
    • Added additional security considerations +
    • +
    • Defined use of subschema identifiers for "id" +
    • +
    • Rewrote section on usage with HTTP +
    • +
    • Rewrote section on usage with rel="describedBy" and rel="profile" +
    • +
    • Fixed numerous invalid examples +
    • +
    +
    +
    +
    draft-zyp-json-schema-04
    +
    +
      +
    • Salvaged from draft v3. +
    • +
    • Split validation keywords into separate document. +
    • +
    • Split hypermedia keywords into separate document. +
    • +
    • Initial post-split draft. +
    • +
    • Mandate the use of JSON Reference, JSON Pointer. +
    • +
    • Define the role of "id". Define URI resolution scope. +
    • +
    • Add interoperability considerations. +
    • +
    +
    +
    +
    draft-zyp-json-schema-00
    +
    +
      +
    • Initial draft. +
    • +
    +
    +
    +
    +
    +
    +
    +

    +Authors' Addresses +

    +
    +
    Austin Wright (editor)
    + +
    +
    +
    Henry Andrews (editor)
    + +
    +
    +
    Ben Hutton (editor)
    + + +
    +
    +
    Greg Dennis
    + + +
    +
    +
    + + + diff --git a/draft/preview/jsonschema-validation.html b/draft/preview/jsonschema-validation.html new file mode 100644 index 00000000..758eeeb3 --- /dev/null +++ b/draft/preview/jsonschema-validation.html @@ -0,0 +1,3173 @@ + + + + + + +JSON Schema Validation: A Vocabulary for Structural Validation of JSON + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Internet-DraftJSON Schema ValidationApril 2022
    Wright, et al.Expires 30 October 2022[Page]
    +
    +
    +
    +
    Workgroup:
    +
    Internet Engineering Task Force
    +
    Internet-Draft:
    +
    draft-bhutton-json-schema-validation-01
    +
    Published:
    +
    + +
    +
    Intended Status:
    +
    Informational
    +
    Expires:
    +
    +
    Authors:
    +
    +
    +
    A. Wright, Ed. +
    +
    +
    +
    H. Andrews, Ed. +
    +
    +
    +
    B. Hutton, Ed. +
    +
    +
    +
    +
    +

    JSON Schema Validation: A Vocabulary for Structural Validation of JSON

    +
    +

    Abstract

    +

    + JSON Schema (application/schema+json) has several purposes, one of which is JSON + instance validation. + This document specifies a vocabulary for JSON Schema to describe the meaning of JSON + documents, provide hints for user interfaces working with JSON data, and to make + assertions about what a valid document must look like.

    +
    +
    +

    +Note to Readers +

    +

    + The issues list for this draft can be found at + https://github.com/json-schema-org/json-schema-spec/issues.

    +

    + For additional information, see https://json-schema.org/.

    +

    + To provide feedback, use this issue tracker, the communication methods listed on the + homepage, or email the document editors.

    +
    +
    +
    +

    +Status of This Memo +

    +

    + This Internet-Draft is submitted in full conformance with the + provisions of BCP 78 and BCP 79.

    +

    + Internet-Drafts are working documents of the Internet Engineering Task + Force (IETF). Note that other groups may also distribute working + documents as Internet-Drafts. The list of current Internet-Drafts is + at https://datatracker.ietf.org/drafts/current/.

    +

    + Internet-Drafts are draft documents valid for a maximum of six months + and may be updated, replaced, or obsoleted by other documents at any + time. It is inappropriate to use Internet-Drafts as reference + material or to cite them other than as "work in progress."

    +

    + This Internet-Draft will expire on 30 October 2022.

    +
    +
    + +
    +
    +

    +Table of Contents +

    + +
    +
    +
    +

    +1. Introduction +

    +

    + JSON Schema can be used to require that a given JSON document (an instance) + satisfies a certain number of criteria. These criteria are asserted by using + keywords described in this specification. In addition, a set of keywords + is also defined to assist in interactive user interface instance generation.

    +

    + This specification will use the concepts, syntax, and terminology defined + by the JSON Schema core [json-schema] specification.

    +
    +
    +

    +2. Conventions and Terminology +

    +

    + + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", + "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be + interpreted as described in RFC 2119 [RFC2119].

    +

    + This specification uses the term "container instance" to refer to both array and + object instances. It uses the term "children instances" to refer to array elements + or object member values.

    +

    + Elements in an array value are said to be unique if no two elements of this array + are equal [json-schema].

    +
    +
    +

    +3. Overview +

    +

    + JSON Schema validation asserts constraints on the structure of instance data. + An instance location that satisfies all asserted constraints is then + annotated with any keywords that contain non-assertion information, + such as descriptive metadata and usage hints. If all locations within + the instance satisfy all asserted constraints, then the instance is + said to be valid against the schema.

    +

    + Each schema object is independently evaluated against each instance location + to which it applies. This greatly simplifies the implementation requirements + for validators by ensuring that they do not need to maintain state across + the document-wide validation process.

    +

    + This specification defines a set of assertion keywords, as well as a small vocabulary + of metadata keywords that can be used to annotate the JSON instance with + useful information. The Section 7 keyword is intended primarily + as an annotation, but can optionally be used as an assertion. The + Section 8 keywords are annotations for working with documents + embedded as JSON strings.

    +
    +
    +

    +4. Interoperability Considerations +

    +
    +

    +4.1. Validation of String Instances +

    +

    + It should be noted that the nul character (\u0000) is valid in a JSON string. An + instance to validate may contain a string value with this character, regardless + of the ability of the underlying programming language to deal with such data.

    +
    +
    +

    +4.2. Validation of Numeric Instances +

    +

    + The JSON specification allows numbers with arbitrary precision, and JSON Schema + does not add any such bounds. + This means that numeric instances processed by JSON Schema can be arbitrarily large and/or + have an arbitrarily long decimal part, regardless of the ability of the + underlying programming language to deal with such data.

    +
    +
    +
    +

    +4.3. Regular Expressions +

    +

    + Keywords that use regular expressions, or constrain the instance value + to be a regular expression, are subject to the interoperability + considerations for regular expressions in the + JSON Schema Core [json-schema] specification.

    +
    +
    +
    +
    +
    +

    +5. Meta-Schema +

    +

    + The current URI for the default JSON Schema dialect meta-schema is + https://json-schema.org/draft/2020-12/schema. + For schema author convenience, this meta-schema describes a dialect + consisting of all vocabularies + defined in this specification and the JSON Schema Core specification, + as well as two former keywords which are reserved for a transitional period. + Individual vocabulary and vocabulary meta-schema URIs are given for + each section below. Certain vocabularies are optional to support, which + is explained in detail in the relevant sections.

    +

    + Updated vocabulary and meta-schema URIs MAY be published between + specification drafts in order to correct errors. Implementations + SHOULD consider URIs dated after this specification draft and + before the next to indicate the same syntax and semantics + as those listed here.

    +
    +
    +
    +

    +6. A Vocabulary for Structural Validation +

    +

    + Validation keywords in a schema impose requirements for successful validation of an + instance. These keywords are all assertions without any annotation behavior.

    +

    + Meta-schemas that do not use "$vocabulary" SHOULD be considered to + require this vocabulary as if its URI were present with a value of true.

    +

    + The current URI for this vocabulary, known as the Validation vocabulary, is: + <https://json-schema.org/draft/2020-12/vocab/validation>.

    +

    + The current URI for the corresponding meta-schema is: + https://json-schema.org/draft/2020-12/meta/validation.

    +
    +
    +

    +6.1. Validation Keywords for Any Instance Type +

    +
    +

    +6.1.1. type +

    +

    + The value of this keyword MUST be either a string or an array. If it is + an array, elements of the array MUST be strings and MUST be unique.

    +

    + String values MUST be one of the six primitive types + ("null", "boolean", "object", "array", "number", or "string"), + or "integer" which matches any number with a zero fractional part.

    +

    + If the value of "type" is a string, then an instance validates successfully if + its type matches the type represented by the value of the string. + + If the value of "type" is an array, then an instance validates successfully if + its type matches any of the types indicated by the strings in the array.

    +
    +
    +
    +

    +6.1.2. enum +

    +

    + The value of this keyword MUST be an array. This array SHOULD have at + least one element. Elements in the array SHOULD be unique.

    +

    + An instance validates successfully against this keyword if its value is + equal to one of the elements in this keyword's array value.

    +

    + Elements in the array might be of any type, including null.

    +
    +
    +
    +

    +6.1.3. const +

    +

    + The value of this keyword MAY be of any type, including null.

    +

    + Use of this keyword is functionally equivalent to an + "enum" (Section 6.1.2) with a single value.

    +

    + An instance validates successfully against this keyword if its value is + equal to the value of the keyword.

    +
    +
    +
    +
    +
    +

    +6.2. Validation Keywords for Numeric Instances (number and integer) +

    +
    +

    +6.2.1. multipleOf +

    +

    + The value of "multipleOf" MUST be a number, strictly greater than 0.

    +

    + A numeric instance is valid only if division by this keyword's value results in + an integer.

    +
    +
    +

    +6.2.2. maximum +

    +

    + The value of "maximum" MUST be a number, representing an inclusive upper limit + for a numeric instance.

    +

    + If the instance is a number, then this keyword validates only if the instance is + less than or exactly equal to "maximum".

    +
    +
    +

    +6.2.3. exclusiveMaximum +

    +

    + The value of "exclusiveMaximum" MUST be a number, representing an exclusive upper + limit for a numeric instance.

    +

    + If the instance is a number, then the instance is valid only if it has a value + strictly less than (not equal to) "exclusiveMaximum".

    +
    +
    +

    +6.2.4. minimum +

    +

    + The value of "minimum" MUST be a number, representing an inclusive lower limit + for a numeric instance.

    +

    + If the instance is a number, then this keyword validates only if the instance is + greater than or exactly equal to "minimum".

    +
    +
    +

    +6.2.5. exclusiveMinimum +

    +

    + The value of "exclusiveMinimum" MUST be a number, representing an exclusive lower + limit for a numeric instance.

    +

    + If the instance is a number, then the instance is valid only if it has a value + strictly greater than (not equal to) "exclusiveMinimum".

    +
    +
    +
    +
    +
    +

    +6.3. Validation Keywords for Strings +

    +
    +

    +6.3.1. maxLength +

    +

    + The value of this keyword MUST be a non-negative integer.

    +

    + A string instance is valid against this keyword if its + length is less than, or equal to, the value of this keyword.

    +

    + The length of a string instance is defined as the number of its + characters as defined by RFC 8259 [RFC8259].

    +
    +
    +

    +6.3.2. minLength +

    +

    + The value of this keyword MUST be a non-negative integer.

    +

    + A string instance is valid against this keyword if its + length is greater than, or equal to, the value of this keyword.

    +

    + The length of a string instance is defined as the number of its + characters as defined by RFC 8259 [RFC8259].

    +

    + Omitting this keyword has the same behavior as a value of 0.

    +
    +
    +
    +

    +6.3.3. pattern +

    +

    + The value of this keyword MUST be a string. This string SHOULD be a + valid regular expression, according to the ECMA-262 regular expression + dialect.

    +

    + A string instance is considered valid if the regular + expression matches the instance successfully. Recall: regular + expressions are not implicitly anchored.

    +
    +
    +
    +
    +
    +

    +6.4. Validation Keywords for Arrays +

    +
    +

    +6.4.1. maxItems +

    +

    + The value of this keyword MUST be a non-negative integer.

    +

    + An array instance is valid against "maxItems" if its size is + less than, or equal to, the value of this keyword.

    +
    +
    +

    +6.4.2. minItems +

    +

    + The value of this keyword MUST be a non-negative integer.

    +

    + An array instance is valid against "minItems" if its size is + greater than, or equal to, the value of this keyword.

    +

    + Omitting this keyword has the same behavior as a value of 0.

    +
    +
    +

    +6.4.3. uniqueItems +

    +

    + The value of this keyword MUST be a boolean.

    +

    + If this keyword has boolean value false, the instance validates + successfully. If it has boolean value true, the instance validates + successfully if all of its elements are unique.

    +

    + Omitting this keyword has the same behavior as a value of false.

    +
    +
    +

    +6.4.4. maxContains +

    +

    + The value of this keyword MUST be a non-negative integer.

    +

    + If "contains" is not present within the same schema object, + then this keyword has no effect.

    +

    + An instance array is valid against "maxContains" in two ways, depending on + the form of the annotation result of an adjacent + "contains" [json-schema] keyword. The first way is if + the annotation result is an array and the length of that array is less than + or equal to the "maxContains" value. The second way is if the annotation + result is a boolean "true" and the instance array length is less than or + equal to the "maxContains" value.

    +
    +
    +

    +6.4.5. minContains +

    +

    + The value of this keyword MUST be a non-negative integer.

    +

    + If "contains" is not present within the same schema object, + then this keyword has no effect.

    +

    + An instance array is valid against "minContains" in two ways, depending on + the form of the annotation result of an adjacent + "contains" [json-schema] keyword. The first way is if + the annotation result is an array and the length of that array is greater + than or equal to the "minContains" value. The second way is if the + annotation result is a boolean "true" and the instance array length is + greater than or equal to the "minContains" value.

    +

    + A value of 0 is allowed, but is only useful for setting a range + of occurrences from 0 to the value of "maxContains". A value of + 0 causes "minContains" to always pass validation (but validation can + still fail against a "maxContains" keyword).

    +

    + Omitting this keyword has the same behavior as a value of 1.

    +
    +
    +
    +

    +6.5. Validation Keywords for Objects +

    +
    +

    +6.5.1. maxProperties +

    +

    + The value of this keyword MUST be a non-negative integer.

    +

    + An object instance is valid against "maxProperties" if its + number of properties is less than, or equal to, the value of this + keyword.

    +
    +
    +

    +6.5.2. minProperties +

    +

    + The value of this keyword MUST be a non-negative integer.

    +

    + An object instance is valid against "minProperties" if its + number of properties is greater than, or equal to, the value of this + keyword.

    +

    + Omitting this keyword has the same behavior as a value of 0.

    +
    +
    +

    +6.5.3. required +

    +

    + The value of this keyword MUST be an array. + Elements of this array, if any, MUST be strings, and MUST be unique.

    +

    + An object instance is valid against this keyword if every item in the array is + the name of a property in the instance.

    +

    + Omitting this keyword has the same behavior as an empty array.

    +
    +
    +

    +6.5.4. dependentRequired +

    +

    + The value of this keyword MUST be an object. Properties in + this object, if any, MUST be arrays. Elements in each array, + if any, MUST be strings, and MUST be unique.

    +

    + This keyword specifies properties that are required if a specific + other property is present. Their requirement is dependent on the + presence of the other property.

    +

    + Validation succeeds if, for each name that appears in both + the instance and as a name within this keyword's value, every + item in the corresponding array is also the name of a property + in the instance.

    +

    + Omitting this keyword has the same behavior as an empty object.

    +
    +
    +
    +
    +
    +

    +7. Vocabularies for Semantic Content With "format" +

    +
    +

    +7.1. Foreword +

    +

    + Structural validation alone may be insufficient to allow an application to correctly + utilize certain values. The "format" annotation keyword is defined to allow schema + authors to convey semantic information for a fixed subset of values which are + accurately described by authoritative resources, be they RFCs or other external + specifications.

    +

    + The value of this keyword is called a format attribute. It MUST be a string. A + format attribute can generally only validate a given set of instance types. If + the type of the instance to validate is not in this set, validation for this + format attribute and instance SHOULD succeed. All format attributes defined + in this section apply to strings, but a format attribute can be specified + to apply to any instance types defined in the data model defined in the + core JSON Schema. [json-schema] + + Note that the "type" keyword in this specification defines an "integer" type + which is not part of the data model. Therefore a format attribute can be + limited to numbers, but not specifically to integers. However, a numeric + format can be used alongside the "type" keyword with a value of "integer", + or could be explicitly defined to always pass if the number is not an integer, + which produces essentially the same behavior as only applying to integers. +

    +

    + The current URI for this vocabulary, known as the Format-Annotation vocabulary, is: + <https://json-schema.org/draft/2020-12/vocab/format-annotation>. The current + URI for the corresponding meta-schema is: + https://json-schema.org/draft/2020-12/meta/format-annotation. + Implementing support for this vocabulary is REQUIRED.

    +

    + In addition to the Format-Annotation vocabulary, a secondary vocabulary is available + for custom meta-schemas that defines "format" as an assertion. The URI for the + Format-Assertion vocabulary, is: + <https://json-schema.org/draft/2020-12/vocab/format-assertion>. The current + URI for the corresponding meta-schema is: + https://json-schema.org/draft/2020-12/meta/format-assertion. + Implementing support for the Format-Assertion vocabulary is OPTIONAL.

    +

    + Specifying both the Format-Annotation and the Format-Assertion vocabularies is functionally + equivalent to specifying only the Format-Assertion vocabulary since its requirements + are a superset of the Format-Annotation vocabulary.

    +
    +
    +

    +7.2. Implementation Requirements +

    +

    + The "format" keyword functions as defined by the vocabulary which is referenced.

    +
    +

    +7.2.1. Format-Annotation Vocabulary +

    +

    + The value of format MUST be collected as an annotation, if the implementation + supports annotation collection. This enables application-level validation when + schema validation is unavailable or inadequate.

    +

    + Implementations MAY still treat "format" as an assertion in addition to an + annotation and attempt to validate the value's conformance to the specified + semantics. The implementation MUST provide options to enable and disable such + evaluation and MUST be disabled by default. Implementations SHOULD document + their level of support for such validation. + + Specifying the Format-Annotation vocabulary and enabling validation in an + implementation should not be viewed as being equivalent to specifying + the Format-Assertion vocabulary since implementations are not required to + provide full validation support when the Format-Assertion vocabulary + is not specified. +

    +

    + When the implementation is configured for assertion behavior, it:

    +
      +
    • + SHOULD provide an implementation-specific best effort validation + for each format attribute defined below; +
    • +
    • + MAY choose to implement validation of any or all format attributes + as a no-op by always producing a validation result of true; +
    • +
    +

    + + This matches the current reality of implementations, which provide + widely varying levels of validation, including no validation at all, + for some or all format attributes. It is also designed to encourage + relying only on the annotation behavior and performing semantic + validation in the application, which is the recommended best practice. +

    +
    +
    +

    +7.2.2. Format-Assertion Vocabulary +

    +

    + When the Format-Assertion vocabulary is declared with a value of true, + implementations MUST provide full validation support for all of the formats + defined by this specificaion. Implementations that cannot provide full + validation support MUST refuse to process the schema.

    +

    + An implementation that supports the Format-Assertion vocabulary:

    +
      +
    • + MUST still collect "format" as an annotation if the implementation + supports annotation collection; +
    • +
    • + MUST evaluate "format" as an assertion; +
    • +
    • + MUST implement syntactic validation for all format attributes defined + in this specification, and for any additional format attributes that + it recognizes, such that there exist possible instance values + of the correct type that will fail validation. +
    • +
    +

    + The requirement for minimal validation of format attributes is intentionally + vague and permissive, due to the complexity involved in many of the attributes. + Note in particular that the requirement is limited to syntactic checking; it is + not to be expected that an implementation would send an email, attempt to connect + to a URL, or otherwise check the existence of an entity identified by a format + instance. + + The expectation is that for simple formats such as date-time, syntactic + validation will be thorough. For a complex format such as email addresses, + which are the amalgamation of various standards and numerous adjustments + over time, with obscure and/or obsolete rules that may or may not be + restricted by other applications making use of the value, a minimal validation + is sufficient. For example, an instance string that does not contain + an "@" is clearly not a valid email address, and an "email" or "hostname" + containing characters outside of 7-bit ASCII is likewise clearly invalid. +

    +

    + It is RECOMMENDED that implementations use a common parsing library for each format, + or a well-known regular expression. Implementations SHOULD clearly document + how and to what degree each format attribute is validated.

    +

    + The standard core and validation meta-schema (Section 5) + includes this vocabulary in its "$vocabulary" keyword with a value of false, + since by default implementations are not required to support this keyword + as an assertion. Supporting the format vocabulary with a value of true is + understood to greatly increase code size and in some cases execution time, + and will not be appropriate for all implementations.

    +
    +
    +

    +7.2.3. Custom format attributes +

    +

    + Implementations MAY support custom format attributes. Save for agreement between + parties, schema authors SHALL NOT expect a peer implementation to support such + custom format attributes. An implementation MUST NOT fail to collect unknown formats + as annotations. When the Format-Assertion vocabulary is specified, implementations + MUST fail upon encountering unknown formats.

    +

    + Vocabularies do not support specifically declaring different value sets for keywords. + Due to this limitation, and the historically uneven implementation of this keyword, + it is RECOMMENDED to define additional keywords in a custom vocabulary rather than + additional format attributes if interoperability is desired.

    +
    +
    +
    +

    +7.3. Defined Formats +

    +
    +

    +7.3.1. Dates, Times, and Duration +

    +

    + These attributes apply to string instances.

    +

    + Date and time format names are derived from + RFC 3339, section 5.6 [RFC3339]. + The duration format is from the ISO 8601 ABNF as given + in Appendix A of RFC 3339.

    +

    + Implementations supporting formats SHOULD implement support for + the following attributes:

    +
    +
    date-time:
    +
    + A string instance is valid against this attribute if it is + a valid representation according to the "date-time' ABNF rule + (referenced above) +
    +
    +
    date:
    +
    + A string instance is valid against this attribute if it is + a valid representation according to the "full-date" ABNF rule + (referenced above) +
    +
    +
    time:
    +
    + A string instance is valid against this attribute if it is + a valid representation according to the "full-time" ABNF rule + (referenced above) +
    +
    +
    duration:
    +
    + A string instance is valid against this attribute if it is + a valid representation according to the "duration" ABNF rule + (referenced above) +
    +
    +
    +

    + Implementations MAY support additional attributes using the other + format names defined anywhere in that RFC. If "full-date" or "full-time" + are implemented, the corresponding short form ("date" or "time" + respectively) MUST be implemented, and MUST behave identically. + Implementations SHOULD NOT define extension attributes + with any name matching an RFC 3339 format unless it validates + according to the rules of that format. + + There is not currently consensus on the need for supporting + all RFC 3339 formats, so this approach of reserving the + namespace will encourage experimentation without committing + to the entire set. Either the format implementation requirements + will become more flexible in general, or these will likely + either be promoted to fully specified attributes or dropped. +

    +
    +
    +

    +7.3.2. Email Addresses +

    +

    + These attributes apply to string instances.

    +

    + A string instance is valid against these attributes if it is a valid + Internet email address as follows:

    +
    +
    email:
    +
    + As defined by the "Mailbox" ABNF rule in + RFC 5321, section 4.1.2 [RFC5321]. +
    +
    +
    idn-email:
    +
    + As defined by the extended "Mailbox" ABNF rule in + RFC 6531, section 3.3 [RFC6531]. +
    +
    +
    +

    + Note that all strings valid against the "email" attribute are also + valid against the "idn-email" attribute.

    +
    +
    +

    +7.3.3. Hostnames +

    +

    + These attributes apply to string instances.

    +

    + A string instance is valid against these attributes if it is a valid + representation for an Internet hostname as follows:

    +
    +
    hostname:
    +
    + As defined by RFC 1123, section 2.1 [RFC1123], + including host names produced using the Punycode algorithm + specified in RFC 5891, section 4.4 [RFC5891]. +
    +
    +
    idn-hostname:
    +
    + As defined by either RFC 1123 as for hostname, or an + internationalized hostname as defined by + RFC 5890, section 2.3.2.3 [RFC5890]. +
    +
    +
    +

    + Note that all strings valid against the "hostname" attribute are also + valid against the "idn-hostname" attribute.

    +
    +
    +

    +7.3.4. IP Addresses +

    +

    + These attributes apply to string instances.

    +

    + A string instance is valid against these attributes if it is a valid + representation of an IP address as follows:

    +
    +
    ipv4:
    +
    + An IPv4 address according to the "dotted-quad" ABNF + syntax as defined in + RFC 2673, section 3.2 [RFC2673]. +
    +
    +
    ipv6:
    +
    + An IPv6 address as defined in + RFC 4291, section 2.2 [RFC4291]. +
    +
    +
    +
    +
    +

    +7.3.5. Resource Identifiers +

    +

    + These attributes apply to string instances.

    +
    +
    uri:
    +
    + A string instance is valid against this attribute if it is + a valid URI, according to [RFC3986]. +
    +
    +
    uri-reference:
    +
    + A string instance is valid against this attribute if it is a valid URI + Reference (either a URI or a relative-reference), + according to [RFC3986]. +
    +
    +
    iri:
    +
    + A string instance is valid against this attribute if it is + a valid IRI, according to [RFC3987]. +
    +
    +
    iri-reference:
    +
    + A string instance is valid against this attribute if it is a valid IRI + Reference (either an IRI or a relative-reference), + according to [RFC3987]. +
    +
    +
    uuid:
    +
    + A string instance is valid against this attribute if it is a valid + string representation of a UUID, according to [RFC4122]. +
    +
    +
    +

    + Note that all valid URIs are valid IRIs, and all valid URI References are + also valid IRI References.

    +

    + Note also that the "uuid" format is for plain UUIDs, not UUIDs in URNs. An example + is "f81d4fae-7dec-11d0-a765-00a0c91e6bf6". For UUIDs as URNs, use the "uri" format, + with a "pattern" regular expression of "^urn:uuid:" to indicate the URI scheme and + URN namespace.

    +
    +
    +

    +7.3.6. uri-template +

    +

    + This attribute applies to string instances.

    +

    + A string instance is valid against this attribute if it is a valid URI Template + (of any level), according to [RFC6570].

    +

    + Note that URI Templates may be used for IRIs; there is no separate + IRI Template specification.

    +
    +
    +

    +7.3.7. JSON Pointers +

    +

    + These attributes apply to string instances.

    +
    +
    json-pointer:
    +
    + A string instance is valid against this attribute if it + is a valid JSON string representation of a JSON Pointer, + according to RFC 6901, section 5 [RFC6901]. +
    +
    +
    relative-json-pointer:
    +
    + A string instance is valid against this attribute if it is a valid + Relative JSON Pointer [relative-json-pointer]. +
    +
    +
    +

    + To allow for both absolute and relative JSON Pointers, use "anyOf" or + "oneOf" to indicate support for either format.

    +
    +
    +

    +7.3.8. regex +

    +

    + This attribute applies to string instances.

    +

    + A regular expression, which SHOULD be valid according to the + ECMA-262 [ecma262] regular expression dialect.

    +

    + Implementations that validate formats MUST accept at least the subset of + ECMA-262 defined in the Regular Expressions (Section 4.3) + section of this specification, and SHOULD accept all valid ECMA-262 expressions.

    +
    +
    +
    +
    +
    +
    +

    +8. A Vocabulary for the Contents of String-Encoded Data +

    +
    +

    +8.1. Foreword +

    +

    + Annotations defined in this section indicate that an instance contains + non-JSON data encoded in a JSON string.

    +

    + These properties provide additional information required to interpret JSON data + as rich multimedia documents. They describe the type of content, how it is encoded, + and/or how it may be validated. They do not function as validation assertions; + a malformed string-encoded document MUST NOT cause the containing instance + to be considered invalid.

    +

    + Meta-schemas that do not use "$vocabulary" SHOULD be considered to + require this vocabulary as if its URI were present with a value of true.

    +

    + The current URI for this vocabulary, known as the Content vocabulary, is: + <https://json-schema.org/draft/2020-12/vocab/content>.

    +

    + The current URI for the corresponding meta-schema is: + https://json-schema.org/draft/2020-12/meta/content.

    +
    +
    +

    +8.2. Implementation Requirements +

    +

    + Due to security and performance concerns, as well as the open-ended nature of + possible content types, implementations MUST NOT automatically decode, parse, + and/or validate the string contents by default. This additionally supports + the use case of embedded documents intended for processing by a different + consumer than that which processed the containing document.

    +

    + All keywords in this section apply only to strings, and have no + effect on other data types.

    +

    + Implementations MAY offer the ability to decode, parse, and/or validate + the string contents automatically. However, it MUST NOT perform these + operations by default, and MUST provide the validation result of each + string-encoded document separately from the enclosing document. This + process SHOULD be equivalent to fully evaluating the instance against + the original schema, followed by using the annotations to decode, parse, + and/or validate each string-encoded document. + + For now, the exact mechanism of performing and returning parsed + data and/or validation results from such an automatic decoding, parsing, + and validating feature is left unspecified. Should such a feature + prove popular, it may be specified more thoroughly in a future draft. +

    +

    + See also the Security Considerations (Section 10) + sections for possible vulnerabilities introduced by automatically + processing the instance string according to these keywords.

    +
    +
    +

    +8.3. contentEncoding +

    +

    + If the instance value is a string, this property defines that the string + SHOULD be interpreted as encoded binary data and decoded using the encoding + named by this property.

    +

    + Possible values indicating base 16, 32, and 64 encodings with several + variations are listed in RFC 4648 [RFC4648]. Additionally, + sections 6.7 and 6.8 of RFC 2045 [RFC2045] provide + encodings used in MIME. This keyword is derived from MIME's + Content-Transfer-Encoding header, which was designed to map binary data + into ASCII characters. It is not related to HTTP's Content-Encoding header, + which is used to encode (e.g. compress or encrypt) + the content of HTTP request and responses.

    +

    + As "base64" is defined in both RFCs, the definition + from RFC 4648 SHOULD be assumed unless the string is specifically intended + for use in a MIME context. Note that all of these encodings result in + strings consisting only of 7-bit ASCII characters. Therefore, this keyword + has no meaning for strings containing characters outside of that range.

    +

    + If this keyword is absent, but "contentMediaType" is present, this + indicates that the encoding is the identity encoding, meaning that + no transformation was needed in order to represent the content in + a UTF-8 string.

    +

    + The value of this property MUST be a string.

    +
    +
    +

    +8.4. contentMediaType +

    +

    + If the instance is a string, this property indicates the media type + of the contents of the string. If "contentEncoding" is present, + this property describes the decoded string.

    +

    + The value of this property MUST be a string, which MUST be a media type, + as defined by RFC 2046 [RFC2046].

    +
    +
    +

    +8.5. contentSchema +

    +

    + If the instance is a string, and if "contentMediaType" is present, this + property contains a schema which describes the structure of the string.

    +

    + This keyword MAY be used with any media type that can be mapped into + JSON Schema's data model.

    +

    + The value of this property MUST be a valid JSON schema. It SHOULD be ignored if + "contentMediaType" is not present.

    +
    +
    +

    +8.6. Example +

    +

    + Here is an example schema, illustrating the use of "contentEncoding" and + "contentMediaType":

    +
    +
    +
    +{
    +    "type": "string",
    +    "contentEncoding": "base64",
    +    "contentMediaType": "image/png"
    +}
    +
    +
    +
    +

    + Instances described by this schema are expected to be strings, + and their values should be interpretable as base64-encoded PNG images.

    +

    + Another example:

    +
    +
    +
    +{
    +    "type": "string",
    +    "contentMediaType": "text/html"
    +}
    +
    +
    +
    +

    + Instances described by this schema are expected to be strings containing HTML, + using whatever character set the JSON string was decoded into. + Per section 8.1 of + RFC 8259 [RFC8259], outside of an entirely closed + system, this MUST be UTF-8.

    +

    + This example describes a JWT that is MACed using the HMAC SHA-256 + algorithm, and requires the "iss" and "exp" fields in its claim set.

    +
    +
    +
    +{
    +    "type": "string",
    +    "contentMediaType": "application/jwt",
    +    "contentSchema": {
    +        "type": "array",
    +        "minItems": 2,
    +        "prefixItems": [
    +            {
    +                "const": {
    +                    "typ": "JWT",
    +                    "alg": "HS256"
    +                }
    +            },
    +            {
    +                "type": "object",
    +                "required": ["iss", "exp"],
    +                "properties": {
    +                    "iss": {"type": "string"},
    +                    "exp": {"type": "integer"}
    +                }
    +            }
    +        ]
    +    }
    +}
    +
    +
    +

    + Note that "contentEncoding" does not appear. While the "application/jwt" + media type makes use of base64url encoding, that is defined by the media + type, which determines how the JWT string is decoded into a list of two + JSON data structures: first the header, and then the payload. Since the + JWT media type ensures that the JWT can be represented in a JSON string, + there is no need for further encoding or decoding.

    +
    +
    +
    +
    +

    +9. A Vocabulary for Basic Meta-Data Annotations +

    +

    + These general-purpose annotation keywords provide commonly used information + for documentation and user interface display purposes. They are not intended + to form a comprehensive set of features. Rather, additional vocabularies + can be defined for more complex annotation-based applications.

    +

    + Meta-schemas that do not use "$vocabulary" SHOULD be considered to + require this vocabulary as if its URI were present with a value of true.

    +

    + The current URI for this vocabulary, known as the Meta-Data vocabulary, is: + <https://json-schema.org/draft/2020-12/vocab/meta-data>.

    +

    + The current URI for the corresponding meta-schema is: + https://json-schema.org/draft/2020-12/meta/meta-data.

    +
    +

    +9.1. "title" and "description" +

    +

    + The value of both of these keywords MUST be a string.

    +

    + Both of these keywords can be used to decorate a user interface with + information about the data produced by this user interface. A title will + preferably be short, whereas a description will provide explanation about + the purpose of the instance described by this schema.

    +
    +
    +

    +9.2. "default" +

    +

    + There are no restrictions placed on the value of this keyword. When + multiple occurrences of this keyword are applicable to a single + sub-instance, implementations SHOULD remove duplicates.

    +

    + This keyword can be used to supply a default JSON value associated with a + particular schema. It is RECOMMENDED that a default value be valid against + the associated schema.

    +
    +
    +

    +9.3. "deprecated" +

    +

    + The value of this keyword MUST be a boolean. When multiple occurrences + of this keyword are applicable to a single sub-instance, applications + SHOULD consider the instance location to be deprecated if any occurrence + specifies a true value.

    +

    + If "deprecated" has a value of boolean true, it indicates that applications + SHOULD refrain from usage of the declared property. It MAY mean the property + is going to be removed in the future.

    +

    + A root schema containing "deprecated" with a value of true indicates that + the entire resource being described MAY be removed in the future.

    +

    + The "deprecated" keyword applies to each instance location to which the + schema object containing the keyword successfully applies. This can + result in scenarios where every array item or object property + is deprecated even though the containing array or object is not.

    +

    + Omitting this keyword has the same behavior as a value of false.

    +
    +
    +

    +9.4. "readOnly" and "writeOnly" +

    +

    + The value of these keywords MUST be a boolean. When multiple occurrences + of these keywords are applicable to a single sub-instance, the resulting + behavior SHOULD be as for a true value if any occurrence specifies a true value, + and SHOULD be as for a false value otherwise.

    +

    + If "readOnly" has a value of boolean true, it indicates that the value + of the instance is managed exclusively by the owning authority, and + attempts by an application to modify the value of this property are + expected to be ignored or rejected by that owning authority.

    +

    + An instance document that is marked as "readOnly" for the entire document + MAY be ignored if sent to the owning authority, or MAY result in an + error, at the authority's discretion.

    +

    + If "writeOnly" has a value of boolean true, it indicates that the value + is never present when the instance is retrieved from the owning authority. + It can be present when sent to the owning authority to update or create + the document (or the resource it represents), but it will not be included + in any updated or newly created version of the instance.

    +

    + An instance document that is marked as "writeOnly" for the entire document + MAY be returned as a blank document of some sort, or MAY produce an error + upon retrieval, or have the retrieval request ignored, at the authority's + discretion.

    +

    + For example, "readOnly" would be used to mark a database-generated serial + number as read-only, while "writeOnly" would be used to mark a password + input field.

    +

    + These keywords can be used to assist in user interface instance generation. + In particular, an application MAY choose to use a widget that hides + input values as they are typed for write-only fields.

    +

    + Omitting these keywords has the same behavior as values of false.

    +
    +
    +

    +9.5. "examples" +

    +

    + The value of this keyword MUST be an array. + There are no restrictions placed on the values within the array. + When multiple occurrences of this keyword are applicable to a single + sub-instance, implementations MUST provide a flat array of all + values rather than an array of arrays.

    +

    + This keyword can be used to provide sample JSON values associated with a + particular schema, for the purpose of illustrating usage. It is + RECOMMENDED that these values be valid against the associated schema.

    +

    + Implementations MAY use the value(s) of "default", if present, as + an additional example. If "examples" is absent, "default" + MAY still be used in this manner.

    +
    +
    +
    +
    +

    +10. Security Considerations +

    +

    + JSON Schema validation defines a vocabulary for JSON Schema core and concerns all + the security considerations listed there.

    +

    + JSON Schema validation allows the use of Regular Expressions, which have numerous + different (often incompatible) implementations. + Some implementations allow the embedding of arbitrary code, which is outside the + scope of JSON Schema and MUST NOT be permitted. + Regular expressions can often also be crafted to be extremely expensive to compute + (with so-called "catastrophic backtracking"), resulting in a denial-of-service + attack.

    +

    + Implementations that support validating or otherwise evaluating instance + string data based on "contentEncoding" and/or "contentMediaType" are at + risk of evaluating data in an unsafe way based on misleading information. + Applications can mitigate this risk by only performing such processing + when a relationship between the schema and instance is established + (e.g., they share the same authority).

    +

    + Processing a media type or encoding is subject to the security considerations + of that media type or encoding. For example, the security considerations + of RFC 4329 Scripting Media Types [RFC4329] apply when + processing JavaScript or ECMAScript encoded within a JSON string.

    +
    +
    +
    +

    +11. References +

    +
    +

    +11.1. Normative References +

    +
    +
    [RFC2119]
    +
    +Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/info/rfc2119>.
    +
    +
    [RFC1123]
    +
    +Braden, R., Ed., "Requirements for Internet Hosts - Application and Support", STD 3, RFC 1123, DOI 10.17487/RFC1123, , <https://www.rfc-editor.org/info/rfc1123>.
    +
    +
    [RFC2045]
    +
    +Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies", RFC 2045, DOI 10.17487/RFC2045, , <https://www.rfc-editor.org/info/rfc2045>.
    +
    +
    [RFC2046]
    +
    +Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types", RFC 2046, DOI 10.17487/RFC2046, , <https://www.rfc-editor.org/info/rfc2046>.
    +
    +
    [RFC2673]
    +
    +Crawford, M., "Binary Labels in the Domain Name System", RFC 2673, DOI 10.17487/RFC2673, , <https://www.rfc-editor.org/info/rfc2673>.
    +
    +
    [RFC3339]
    +
    +Klyne, G. and C. Newman, "Date and Time on the Internet: Timestamps", RFC 3339, DOI 10.17487/RFC3339, , <https://www.rfc-editor.org/info/rfc3339>.
    +
    +
    [RFC3986]
    +
    +Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, DOI 10.17487/RFC3986, , <https://www.rfc-editor.org/info/rfc3986>.
    +
    +
    [RFC3987]
    +
    +Duerst, M. and M. Suignard, "Internationalized Resource Identifiers (IRIs)", RFC 3987, DOI 10.17487/RFC3987, , <https://www.rfc-editor.org/info/rfc3987>.
    +
    +
    [RFC4122]
    +
    +Leach, P., Mealling, M., and R. Salz, "A Universally Unique IDentifier (UUID) URN Namespace", RFC 4122, DOI 10.17487/RFC4122, , <https://www.rfc-editor.org/info/rfc4122>.
    +
    +
    [RFC4291]
    +
    +Hinden, R. and S. Deering, "IP Version 6 Addressing Architecture", RFC 4291, DOI 10.17487/RFC4291, , <https://www.rfc-editor.org/info/rfc4291>.
    +
    +
    [RFC4648]
    +
    +Josefsson, S., "The Base16, Base32, and Base64 Data Encodings", RFC 4648, DOI 10.17487/RFC4648, , <https://www.rfc-editor.org/info/rfc4648>.
    +
    +
    [RFC5321]
    +
    +Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, DOI 10.17487/RFC5321, , <https://www.rfc-editor.org/info/rfc5321>.
    +
    +
    [RFC5890]
    +
    +Klensin, J., "Internationalized Domain Names for Applications (IDNA): Definitions and Document Framework", RFC 5890, DOI 10.17487/RFC5890, , <https://www.rfc-editor.org/info/rfc5890>.
    +
    +
    [RFC5891]
    +
    +Klensin, J., "Internationalized Domain Names in Applications (IDNA): Protocol", RFC 5891, DOI 10.17487/RFC5891, , <https://www.rfc-editor.org/info/rfc5891>.
    +
    +
    [RFC6570]
    +
    +Gregorio, J., Fielding, R., Hadley, M., Nottingham, M., and D. Orchard, "URI Template", RFC 6570, DOI 10.17487/RFC6570, , <https://www.rfc-editor.org/info/rfc6570>.
    +
    +
    [RFC6531]
    +
    +Yao, J. and W. Mao, "SMTP Extension for Internationalized Email", RFC 6531, DOI 10.17487/RFC6531, , <https://www.rfc-editor.org/info/rfc6531>.
    +
    +
    [RFC6901]
    +
    +Bryan, P., Ed., Zyp, K., and M. Nottingham, Ed., "JavaScript Object Notation (JSON) Pointer", RFC 6901, DOI 10.17487/RFC6901, , <https://www.rfc-editor.org/info/rfc6901>.
    +
    +
    [RFC8259]
    +
    +Bray, T., Ed., "The JavaScript Object Notation (JSON) Data Interchange Format", STD 90, RFC 8259, DOI 10.17487/RFC8259, , <https://www.rfc-editor.org/info/rfc8259>.
    +
    +
    [ecma262]
    +
    +"ECMA-262, 11th edition specification", , <https://www.ecma-international.org/ecma-262/11.0>.
    +
    +
    [relative-json-pointer]
    +
    +Luff, G., Andrews, H., and B. Hutton, Ed., "Relative JSON Pointers", Work in Progress, Internet-Draft, draft-handrews-relative-json-pointer-01, , <https://datatracker.ietf.org/doc/html/draft-handrews-relative-json-pointer-01>.
    +
    +
    [json-schema]
    +
    +Wright, A., Andrews, H., Hutton, B., and G. Dennis, "JSON Schema: A Media Type for Describing JSON Documents", Work in Progress, Internet-Draft, draft-bhutton-json-schema-01, , <https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-01>.
    +
    +
    +
    +
    +

    +11.2. Informative References +

    +
    +
    [RFC4329]
    +
    +Hoehrmann, B., "Scripting Media Types", RFC 4329, DOI 10.17487/RFC4329, , <https://www.rfc-editor.org/info/rfc4329>.
    +
    +
    +
    +
    +
    +

    +Appendix A. Keywords Moved from Validation to Core +

    +

    + Several keywords have been moved from this document into the + Core Specification [json-schema] as of this draft, in some + cases with re-naming or other changes. This affects the following former + validation keywords:

    +
    +
    "definitions"
    +
    + Renamed to "$defs" to match "$ref" and be shorter to type. + Schema vocabulary authors SHOULD NOT define a "definitions" keyword + with different behavior in order to avoid invalidating schemas that + still use the older name. While "definitions" is absent in the + single-vocabulary meta-schemas referenced by this document, it + remains present in the default meta-schema, and implementations + SHOULD assume that "$defs" and "definitions" have the same + behavior when that meta-schema is used. +
    +
    +
    "allOf", "anyOf", "oneOf", "not", "if", "then", "else", "items", "additionalItems", "contains", "propertyNames", "properties", "patternProperties", "additionalProperties"
    +
    + All of these keywords apply subschemas to the instance and combine + their results, without asserting any conditions of their own. + Without assertion keywords, these applicators can only cause assertion + failures by using the false boolean schema, or by inverting the result + of the true boolean schema (or equivalent schema objects). + For this reason, they are better defined as a generic mechanism on which + validation, hyper-schema, and extension vocabularies can all be based. +
    +
    +
    "dependencies"
    +
    + This keyword had two different modes of behavior, which made it + relatively challenging to implement and reason about. + The schema form has been moved to Core and renamed to + "dependentSchemas", as part of the applicator vocabulary. + It is analogous to "properties", except that instead of applying + its subschema to the property value, it applies it to the object + containing the property. + The property name array form is retained here and renamed to + "dependentRequired", as it is an assertion which is a shortcut + for the conditional use of the "required" assertion keyword. +
    +
    +
    +
    +
    +

    +Appendix B. Acknowledgments +

    +

    + Thanks to + Gary Court, + Francis Galiegue, + Kris Zyp, + and Geraint Luff + for their work on the initial drafts of JSON Schema.

    +

    + Thanks to + Jason Desrosiers, + Daniel Perrett, + Erik Wilde, + Evgeny Poberezkin, + Brad Bowman, + Gowry Sankar, + Donald Pipowitch, + Dave Finlay, + Denis Laxalde, + Phil Sturgeon, + Shawn Silverman, + and Karen Etheridge + for their submissions and patches to the document.

    +
    +
    +

    +Appendix C. ChangeLog +

    +

    + This section to be removed before leaving Internet-Draft status.

    +
    +
    draft-bhutton-json-schema-validation-00
    +
    +
      +
    • Correct email format RFC reference to 5321 instead of 5322 +
    • +
    • Clarified the set and meaning of "contentEncoding" values +
    • +
    • Reference ECMA-262, 11th edition for regular expression support +
    • +
    • Split "format" into an annotation only vocabulary and an assertion vocabulary +
    • +
    • Clarify "deprecated" when applicable to arrays +
    • +
    +
    +
    +
    draft-handrews-json-schema-validation-02
    +
    +
      +
    • Grouped keywords into formal vocabularies +
    • +
    • Update "format" implementation requirements in terms of vocabularies +
    • +
    • By default, "format" MUST NOT be validated, although validation can be enabled +
    • +
    • A vocabulary declaration can be used to require "format" validation +
    • +
    • Moved "definitions" to the core spec as "$defs" +
    • +
    • Moved applicator keywords to the core spec +
    • +
    • Renamed the array form of "dependencies" to "dependentRequired", moved the schema form to the core spec +
    • +
    • Specified all "content*" keywords as annotations, not assertions +
    • +
    • Added "contentSchema" to allow applying a schema to a string-encoded document +
    • +
    • Also allow RFC 4648 encodings in "contentEncoding" +
    • +
    • Added "minContains" and "maxContains" +
    • +
    • Update RFC reference for "hostname" and "idn-hostname" +
    • +
    • Add "uuid" and "duration" formats +
    • +
    +
    +
    +
    draft-handrews-json-schema-validation-01
    +
    +
      +
    • This draft is purely a clarification with no functional changes +
    • +
    • Provided the general principle behind ignoring annotations under "not" and similar cases +
    • +
    • Clarified "if"/"then"/"else" validation interactions +
    • +
    • Clarified "if"/"then"/"else" behavior for annotation +
    • +
    • Minor formatting and cross-referencing improvements +
    • +
    +
    +
    +
    draft-handrews-json-schema-validation-00
    +
    +
      +
    • Added "if"/"then"/"else" +
    • +
    • Classify keywords as assertions or annotations per the core spec +
    • +
    • Warn of possibly removing "dependencies" in the future +
    • +
    • Grouped validation keywords into sub-sections for readability +
    • +
    • Moved "readOnly" from hyper-schema to validation meta-data +
    • +
    • Added "writeOnly" +
    • +
    • Added string-encoded media section, with former hyper-schema "media" keywords +
    • +
    • Restored "regex" format (removal was unintentional) +
    • +
    • Added "date" and "time" formats, and reserved additional RFC 3339 format names +
    • +
    • I18N formats: "iri", "iri-reference", "idn-hostname", "idn-email" +
    • +
    • Clarify that "json-pointer" format means string encoding, not URI fragment +
    • +
    • Fixed typo that inverted the meaning of "minimum" and "exclusiveMinimum" +
    • +
    • Move format syntax references into Normative References +
    • +
    • JSON is a normative requirement +
    • +
    +
    +
    +
    draft-wright-json-schema-validation-01
    +
    +
      +
    • Standardized on hyphenated format names with full words ("uriref" becomes "uri-reference") +
    • +
    • Add the formats "uri-template" and "json-pointer" +
    • +
    • Changed "exclusiveMaximum"/"exclusiveMinimum" from boolean modifiers of "maximum"/"minimum" to independent numeric fields. +
    • +
    • Split the additionalItems/items into two sections +
    • +
    • Reworked properties/patternProperties/additionalProperties definition +
    • +
    • Added "examples" keyword +
    • +
    • Added "contains" keyword +
    • +
    • Allow empty "required" and "dependencies" arrays +
    • +
    • Fixed "type" reference to primitive types +
    • +
    • Added "const" keyword +
    • +
    • Added "propertyNames" keyword +
    • +
    +
    +
    +
    draft-wright-json-schema-validation-00
    +
    +
      +
    • Added additional security considerations +
    • +
    • Removed reference to "latest version" meta-schema, use numbered version instead +
    • +
    • Rephrased many keyword definitions for brevity +
    • +
    • Added "uriref" format that also allows relative URI references +
    • +
    +
    +
    +
    draft-fge-json-schema-validation-00
    +
    +
      +
    • Initial draft. +
    • +
    • Salvaged from draft v3. +
    • +
    • Redefine the "required" keyword. +
    • +
    • Remove "extends", "disallow" +
    • +
    • Add "anyOf", "allOf", "oneOf", "not", "definitions", "minProperties", + "maxProperties". +
    • +
    • "dependencies" member values can no longer be single strings; at + least one element is required in a property dependency array. +
    • +
    • Rename "divisibleBy" to "multipleOf". +
    • +
    • "type" arrays can no longer have schemas; remove "any" as a possible + value. +
    • +
    • Rework the "format" section; make support optional. +
    • +
    • "format": remove attributes "phone", "style", "color"; rename + "ip-address" to "ipv4"; add references for all attributes. +
    • +
    • Provide algorithms to calculate schema(s) for array/object + instances. +
    • +
    • Add interoperability considerations. +
    • +
    +
    +
    +
    +
    +
    +
    +

    +Authors' Addresses +

    +
    +
    Austin Wright (editor)
    + +
    +
    +
    Henry Andrews (editor)
    + +
    +
    +
    Ben Hutton (editor)
    + + +
    +
    +
    + + + diff --git a/work-in-progress/index.md b/work-in-progress/index.md index f2cf1e87..8e16de33 100644 --- a/work-in-progress/index.md +++ b/work-in-progress/index.md @@ -7,6 +7,44 @@ permalink: /work-in-progress * TOC {:toc} -We're working towards draft 2021-NN. +## Right now + +We're working towards JSON Schema 2022-NN. + +Additionally, we're working on draft 2020-12-patch-1 ([Associated GitHub milestone](https://github.com/json-schema-org/json-schema-spec/milestone/9)) + +## Release latest news + +On 2022-04-29, we published Release Candiate 0 for this release. + +These documents will be given the IETF identifiers `draft-bhutton-*-01`. + +## RC-0 preview + +You can find RC-0 preview of the following documents: +- [JSON Schema Core specificatoin](/draft/preview/jsonschema-core.html) +- [JSON Schema Validation specification](/draft/preview/jsonschema-validation.html) + +There are no changes to the Relative JSON Pointer specification. + +View the git diff on GitHub for: +- [draft 2020-12 release to 2020-12-patch-01-rc0](https://github.com/json-schema-org/json-schema-spec/compare/2020-12...draft-bhutton--01-rc0) (git tag `draft-bhutton--01-rc0) +- [draft 2020-12 release to master](https://github.com/json-schema-org/json-schema-spec/compare/2020-12...master) (This may include changes based on Release Candidate feedback) + +This "work in progress" page will be updated as the release progress for 2020-12-patch-1 progresses. + +## How to provide feedback for RC-0 +Note, feedback for RC-0 closes on 2022-05-14. + +Please make use of the two week feedback window for RC-0 by either: +- Filing issues on the [specification repository](https://github.com/json-schema-org/json-schema-spec/issues), making it clear the issue relates to 2020-12-patch-1-RC-0 +- Discuss in the [#specification channel on our Slack server](https://json-schema.slack.com/archives/CT7FF623C) - You will need to join if you haven't already + +**Please note, only feedback relating specifically to the changes found in the above diff are useful. This release is not making functional changes.** + +The previous `draft 2020-12` specification documents will become obsolete, as did draft-07 specification documents when they were patched. + +If you have suggestions for changes to the specification in general, we invite you to open a [Discussion on our GitHub organization](https://github.com/orgs/json-schema-org/discussions) and/or chat with us in the #general or #specificaiton channels on our [Slack server](/slack). + See the [GitHub repository](https://github.com/json-schema-org/json-schema-spec) for ongoing spec work. From d492f1f68e6cbf547ea7df48eb4aff58118fa98d Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Fri, 29 Apr 2022 09:30:35 +0100 Subject: [PATCH 086/206] Moved 2020-12-p1-rc-0 into specific folder in preview folder --- draft/preview/{ => 2020-12-p1-rc-0}/jsonschema-core.html | 0 .../preview/{ => 2020-12-p1-rc-0}/jsonschema-validation.html | 0 work-in-progress/index.md | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename draft/preview/{ => 2020-12-p1-rc-0}/jsonschema-core.html (100%) rename draft/preview/{ => 2020-12-p1-rc-0}/jsonschema-validation.html (100%) diff --git a/draft/preview/jsonschema-core.html b/draft/preview/2020-12-p1-rc-0/jsonschema-core.html similarity index 100% rename from draft/preview/jsonschema-core.html rename to draft/preview/2020-12-p1-rc-0/jsonschema-core.html diff --git a/draft/preview/jsonschema-validation.html b/draft/preview/2020-12-p1-rc-0/jsonschema-validation.html similarity index 100% rename from draft/preview/jsonschema-validation.html rename to draft/preview/2020-12-p1-rc-0/jsonschema-validation.html diff --git a/work-in-progress/index.md b/work-in-progress/index.md index 8e16de33..30aaea9c 100644 --- a/work-in-progress/index.md +++ b/work-in-progress/index.md @@ -22,8 +22,8 @@ These documents will be given the IETF identifiers `draft-bhutton-*-01`. ## RC-0 preview You can find RC-0 preview of the following documents: -- [JSON Schema Core specificatoin](/draft/preview/jsonschema-core.html) -- [JSON Schema Validation specification](/draft/preview/jsonschema-validation.html) +- [JSON Schema Core specificatoin](/draft/preview/2020-12-p1-rc-0/jsonschema-core.html) +- [JSON Schema Validation specification](/draft/preview/2020-12-p1-rc-0/jsonschema-validation.html) There are no changes to the Relative JSON Pointer specification. From 85dd6030e077a75ecf0edf36891542d3f302fa45 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Sat, 30 Apr 2022 10:27:51 -0700 Subject: [PATCH 087/206] spelling --- work-in-progress/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/work-in-progress/index.md b/work-in-progress/index.md index 30aaea9c..81f5f427 100644 --- a/work-in-progress/index.md +++ b/work-in-progress/index.md @@ -22,7 +22,7 @@ These documents will be given the IETF identifiers `draft-bhutton-*-01`. ## RC-0 preview You can find RC-0 preview of the following documents: -- [JSON Schema Core specificatoin](/draft/preview/2020-12-p1-rc-0/jsonschema-core.html) +- [JSON Schema Core specification](/draft/preview/2020-12-p1-rc-0/jsonschema-core.html) - [JSON Schema Validation specification](/draft/preview/2020-12-p1-rc-0/jsonschema-validation.html) There are no changes to the Relative JSON Pointer specification. From 228c76655ff3cf4ff90a1615ae9532f395bdc557 Mon Sep 17 00:00:00 2001 From: Clemens Uhlenhut Date: Mon, 2 May 2022 09:46:33 +0200 Subject: [PATCH 088/206] Update implementations.md Added information about the new JSON schema debugger in JSONBuddy. --- implementations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implementations.md b/implementations.md index 5ff600c7..45f97ab3 100644 --- a/implementations.md +++ b/implementations.md @@ -259,7 +259,7 @@ _None currently support draft-06 or later._ - [Altova XMLSpy 2019r3](https://www.altova.com/xmlspy-xml-editor#json_schema) - *Graphical JSON Schema editor for draft-06 and draft-7, as well as validation of JSON files based on JSON Schema* - [Dashjoin JSON Schema editor](https://dashjoin.github.io/#/schema) - *Graphical online JSON Schema editor for draft-06 (minus oneOf, anyOf, allOf, not). The generated schema can be tested immediately via a form that is driven by it.* - [Hackolade Studio](https://hackolade.com/help/JSONSchemaEditor.html) - *Visual JSON Schema editor for draft-04, draft-06, draft-07, 2019-09, 2020-12, as well as data modeling tool for NoSQL databases, storage formats, REST APIs, and JSON in RDBMS. Also converts to and from: different draft specifications, DDL, XSD, Swagger, OpenAPI, YAML, Avro, Parquet, Protobuf, and most of the NoSQL script syntaxes. Includes a GUI for Entity-Relationship Diagrams and a Command-Line Interface.* -- [JSONBuddy](https://www.json-buddy.com/) - *Text and grid-style JSON editor and validator with JSON schema analyzer, context sensitive entry-helpers and sample data generation based on JSON schema. Support for draft-4, draft-6, draft-7 and 2019-09.* +- [JSONBuddy](https://www.json-buddy.com/) - *Text and grid-style JSON editor and validator with JSON schema analyzer, context sensitive entry-helpers and sample data generation based on JSON schema. Support for draft-4, draft-6, draft-7 and 2019-09. JSON Schema validation debugger: Step through the validation process and set breakpoints.* - [JSONEditor Online](https://jsoneditoronline.org/) - *View, edit, format, and validate JSON online* Support draft-4, draft-6, and draft-7. - [Liquid JSON Schema Editor](https://www.liquid-technologies.com/json-schema-editor) - *Graphical JSON Schema editor for draft-04, draft-06, draft-07 and 2019-09, with split source code and grphical editing. Includes validation of JSON files based on JSON Schema, JSON Sample Generator and JSON Schema Documentation Generator.* - [Oxygen JSON Editor](https://www.oxygenxml.com/xml_editor/json.html) - *JSON editor with a variety of editing features and helper views. Support for validation and editing JSON Schema draft-4, draft-6, and draft-7. Validation and editing of JSON files based on JSON Schema.* From 63ebf52b5b48d30821eb82ddf95ad9f0ce9baa72 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 May 2022 22:02:06 +0000 Subject: [PATCH 089/206] Bump nokogiri from 1.10.5 to 1.13.6 Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.5 to 1.13.6. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.5...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3e8e182a..25dd3da2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -199,7 +199,7 @@ GEM rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) mercenary (0.3.6) - mini_portile2 (2.4.0) + mini_portile2 (2.8.0) minima (2.4.1) jekyll (~> 3.5) jekyll-feed (~> 0.9) @@ -207,13 +207,15 @@ GEM minitest (5.11.3) multipart-post (2.0.0) net-dns (0.8.0) - nokogiri (1.10.5) - mini_portile2 (~> 2.4.0) + nokogiri (1.13.6) + mini_portile2 (~> 2.8.0) + racc (~> 1.4) octokit (4.8.0) sawyer (~> 0.8.0, >= 0.5.3) pathutil (0.16.1) forwardable-extended (~> 2.6) public_suffix (2.0.5) + racc (1.6.0) rb-fsevent (0.10.3) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) From 0f6888b7d6160126f1fcab2bda6f931f519e6d4b Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Mon, 23 May 2022 11:45:02 +0100 Subject: [PATCH 090/206] Update office hours schedule Now only on the first Tuesday of the month, and by appointment --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index e41723d8..57313053 100644 --- a/index.md +++ b/index.md @@ -39,7 +39,7 @@ We hold weekly Office Hours and twice monthly Open Community Working Meetings. 👷 Open Community Working Meetings -Office Hours are every Tuesday at 15:00 UTC. +Office Hours are every first Tuesday of the month at 15:00 UTC, and by appointment. Open Community Working Meetings are every First and Third Friday of the month at 12:00 PT. From 298ae8683bf4d065a6fa5507ec1f4cc134e2211c Mon Sep 17 00:00:00 2001 From: Kamil Giszczak Date: Tue, 31 May 2022 12:52:36 +0200 Subject: [PATCH 091/206] Add Shale, a Ruby schema and code generator --- implementations.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/implementations.md b/implementations.md index 785552b2..9ff96380 100644 --- a/implementations.md +++ b/implementations.md @@ -124,6 +124,8 @@ For example, the only incompatibilities between draft-04 and draft-06 involve `e - [jsonschema-generator](https://github.com/victools/jsonschema-generator) (Apache 2.0) - generates schemas from Java types *supports Draft 7 and Draft 2019-09* - Scala - [scala-jsonschema](https://github.com/andyglow/scala-jsonschema) (Apache 2.0) - generates schemad out of Scala case classes +- Ruby + - [Shale](https://github.com/kgiszczak/shale) (MIT) - generates schema from Ruby models *supports Draft 2020-12* #### From data @@ -175,6 +177,8 @@ are the only keywords that changed. - [schemafy](https://github.com/Marwes/schemafy/) - generates Rust types and serialization code from a JSON schema. *supports Draft 4* - TypeScript - [jsongenerator](https://github.com/jimblackler/jsonschematypes/tree/master/codegen) *JSON Schema 2019-09, draft-07, -06, -04, -03* (Apache-2.0) +- Ruby + - [Shale](https://github.com/kgiszczak/shale) (MIT) - generates Ruby models from a JSON schema *supports Draft 2020-12* #### Web UI generation From 4991c4b9aeca623613c589acc3f52db67bc44805 Mon Sep 17 00:00:00 2001 From: Sam Weaver Date: Wed, 1 Jun 2022 15:12:18 -0400 Subject: [PATCH 092/206] Move JeSSE from obsolete to modern libraries on implementations page --- _data/validator-libraries-modern.yml | 6 ++++++ _data/validator-libraries-obsolete.yml | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 75b7ce46..ca0a2517 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -82,6 +82,12 @@ date-draft: draft: [7, 6, 4] license: MIT +- name: Erlang + implementations: + - name: JeSSE + url: https://github.com/for-GET/jesse + draft: [6, 4, 3] + license: "Apache 2.0" - name: Go implementations: - name: gojsonschema diff --git a/_data/validator-libraries-obsolete.yml b/_data/validator-libraries-obsolete.yml index f1c3a4e6..6cc5bd40 100644 --- a/_data/validator-libraries-obsolete.yml +++ b/_data/validator-libraries-obsolete.yml @@ -53,12 +53,6 @@ notes: draft: [4] license: BSL-1.0 -- name: Erlang - implementations: - - name: JeSSE - url: https://github.com/for-GET/jesse - draft: [4, 3] - license: "Apache 2.0" - name: Go implementations: - name: validate-json From a7be71bb5d0af223018b76093f0361e8816bd8d6 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Tue, 14 Jun 2022 09:29:01 +0100 Subject: [PATCH 093/206] Moved previous 2020-12 core and validation specification documents to obsolete folder, in line with previous obsolete structure from draft-07 --- draft/2020-12/{ => obsolete}/json-schema-core.html | 0 draft/2020-12/{ => obsolete}/json-schema-validation.html | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename draft/2020-12/{ => obsolete}/json-schema-core.html (100%) rename draft/2020-12/{ => obsolete}/json-schema-validation.html (100%) diff --git a/draft/2020-12/json-schema-core.html b/draft/2020-12/obsolete/json-schema-core.html similarity index 100% rename from draft/2020-12/json-schema-core.html rename to draft/2020-12/obsolete/json-schema-core.html diff --git a/draft/2020-12/json-schema-validation.html b/draft/2020-12/obsolete/json-schema-validation.html similarity index 100% rename from draft/2020-12/json-schema-validation.html rename to draft/2020-12/obsolete/json-schema-validation.html From a2530881fe5dfd7a5fe6fffde2c4be992c84ce70 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Tue, 14 Jun 2022 09:43:04 +0100 Subject: [PATCH 094/206] Remove 2020-12 patch preview Revert work in progress page to prior release ramp up --- .../2020-12-p1-rc-0/jsonschema-core.html | 5802 ----------------- .../jsonschema-validation.html | 3173 --------- work-in-progress/index.md | 40 +- 3 files changed, 1 insertion(+), 9014 deletions(-) delete mode 100644 draft/preview/2020-12-p1-rc-0/jsonschema-core.html delete mode 100644 draft/preview/2020-12-p1-rc-0/jsonschema-validation.html diff --git a/draft/preview/2020-12-p1-rc-0/jsonschema-core.html b/draft/preview/2020-12-p1-rc-0/jsonschema-core.html deleted file mode 100644 index b8a7b2e9..00000000 --- a/draft/preview/2020-12-p1-rc-0/jsonschema-core.html +++ /dev/null @@ -1,5802 +0,0 @@ - - - - - - -JSON Schema: A Media Type for Describing JSON Documents - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Internet-DraftJSON SchemaApril 2022
    Wright, et al.Expires 30 October 2022[Page]
    -
    -
    -
    -
    Workgroup:
    -
    Internet Engineering Task Force
    -
    Internet-Draft:
    -
    draft-bhutton-json-schema-01
    -
    Published:
    -
    - -
    -
    Intended Status:
    -
    Informational
    -
    Expires:
    -
    -
    Authors:
    -
    -
    -
    A. Wright, Ed. -
    -
    -
    -
    H. Andrews, Ed. -
    -
    -
    -
    B. Hutton, Ed. -
    -
    -
    -
    G. Dennis
    -
    -
    -
    -
    -

    JSON Schema: A Media Type for Describing JSON Documents

    -
    -

    Abstract

    -

    - JSON Schema defines the media type "application/schema+json", a JSON-based format - for describing the structure of JSON data. - JSON Schema asserts what a JSON document must look like, - ways to extract information from it, - and how to interact with it. - The "application/schema-instance+json" media type provides additional - feature-rich integration with "application/schema+json" beyond what can be offered - for "application/json" documents.

    -
    -
    -

    -Note to Readers -

    -

    - The issues list for this draft can be found at - https://github.com/json-schema-org/json-schema-spec/issues.

    -

    - For additional information, see https://json-schema.org/.

    -

    - To provide feedback, use this issue tracker, the communication methods listed on the - homepage, or email the document editors.

    -
    -
    -
    -

    -Status of This Memo -

    -

    - This Internet-Draft is submitted in full conformance with the - provisions of BCP 78 and BCP 79.

    -

    - Internet-Drafts are working documents of the Internet Engineering Task - Force (IETF). Note that other groups may also distribute working - documents as Internet-Drafts. The list of current Internet-Drafts is - at https://datatracker.ietf.org/drafts/current/.

    -

    - Internet-Drafts are draft documents valid for a maximum of six months - and may be updated, replaced, or obsoleted by other documents at any - time. It is inappropriate to use Internet-Drafts as reference - material or to cite them other than as "work in progress."

    -

    - This Internet-Draft will expire on 30 October 2022.

    -
    -
    - -
    -
    -

    -Table of Contents -

    - -
    -
    -
    -

    -1. Introduction -

    -

    - JSON Schema is a JSON media type for defining the structure of JSON data. JSON Schema - is intended to define validation, documentation, hyperlink navigation, and interaction - control of JSON data.

    -

    - This specification defines JSON Schema core terminology and mechanisms, including - pointing to another JSON Schema by reference, - dereferencing a JSON Schema reference, - specifying the dialect being used, - specifying a dialect's vocabulary requirements, - and defining the expected output.

    -

    - Other specifications define the vocabularies that perform assertions about validation, - linking, annotation, navigation, and interaction.

    -
    -
    -

    -2. Conventions and Terminology -

    -

    - - - The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", - "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be - interpreted as described in RFC 2119 [RFC2119].

    -

    - The terms "JSON", "JSON text", "JSON value", "member", "element", "object", "array", - "number", "string", "boolean", "true", "false", and "null" in this document are to - be interpreted as defined in RFC 8259 [RFC8259].

    -
    -
    -

    -3. Overview -

    -

    - This document proposes a new media type "application/schema+json" to identify a JSON - Schema for describing JSON data. - It also proposes a further optional media type, "application/schema-instance+json", - to provide additional integration features. - JSON Schemas are themselves JSON documents. - This, and related specifications, define keywords allowing authors to describe JSON - data in several ways.

    -

    - JSON Schema uses keywords to assert constraints on JSON instances or annotate those - instances with additional information. Additional keywords are used to apply - assertions and annotations to more complex JSON data structures, or based on - some sort of condition.

    -

    - To facilitate re-use, keywords can be organized into vocabularies. A vocabulary - consists of a list of keywords, together with their syntax and semantics. - A dialect is defined as a set of vocabularies and their required support - identified in a meta-schema.

    -

    - JSON Schema can be extended either by defining additional vocabularies, - or less formally by defining additional keywords outside of any vocabulary. - Unrecognized individual keywords simply have their values collected as annotations, - while the behavior with respect to an unrecognized vocabulary can be controlled - when declaring which vocabularies are in use.

    -

    - This document defines a core vocabulary that MUST be supported by any - implementation, and cannot be disabled. Its keywords are each prefixed - with a "$" character to emphasize their required nature. This vocabulary - is essential to the functioning of the "application/schema+json" media - type, and is used to bootstrap the loading of other vocabularies.

    -

    - Additionally, this document defines a RECOMMENDED vocabulary of keywords - for applying subschemas conditionally, and for applying subschemas to - the contents of objects and arrays. Either this vocabulary or one very - much like it is required to write schemas for non-trivial JSON instances, - whether those schemas are intended for assertion validation, annotation, - or both. While not part of the required core vocabulary, for maximum - interoperability this additional vocabulary is included in this document - and its use is strongly encouraged.

    -

    - Further vocabularies for purposes such as structural validation or - hypermedia annotation are defined in other documents. These other - documents each define a dialect collecting the standard sets of - vocabularies needed to write schemas for that document's purpose.

    -
    -
    -

    -4. Definitions -

    -
    -

    -4.1. JSON Document -

    -

    - A JSON document is an information resource (series of octets) described by the - application/json media type.

    -

    - In JSON Schema, the terms "JSON document", "JSON text", and "JSON value" are - interchangeable because of the data model it defines.

    -

    - JSON Schema is only defined over JSON documents. However, any document or memory - structure that can be parsed into or processed according to the JSON Schema data - model can be interpreted against a JSON Schema, including media types like - CBOR [RFC7049].

    -
    -
    -

    -4.2. Instance -

    -

    - A JSON document to which a schema is applied is known as an "instance".

    -

    - JSON Schema is defined over "application/json" or compatible documents, - including media types with the "+json" structured syntax suffix.

    -

    - Among these, this specification defines the "application/schema-instance+json" - media type which defines handling for fragments in the URI.

    -
    -

    -4.2.1. Instance Data Model -

    -

    - JSON Schema interprets documents according to a data model. A JSON value - interpreted according to this data model is called an "instance".

    -

    - An instance has one of six primitive types, and a range of possible values - depending on the type:

    -
    -
    null:
    -
    A JSON "null" value -
    -
    -
    boolean:
    -
    A "true" or "false" value, from the JSON "true" or "false" value -
    -
    -
    object:
    -
    An unordered set of properties mapping a string to an instance, from the JSON "object" value -
    -
    -
    array:
    -
    An ordered list of instances, from the JSON "array" value -
    -
    -
    number:
    -
    An arbitrary-precision, base-10 decimal number value, from the JSON "number" value -
    -
    -
    string:
    -
    A string of Unicode code points, from the JSON "string" value -
    -
    -
    -

    - Whitespace and formatting concerns, including different lexical - representations of numbers that are equal within the data model, are thus - outside the scope of JSON Schema. JSON Schema - vocabularies (Section 8.1) that wish - to work with such differences in lexical representations SHOULD define - keywords to precisely interpret formatted strings within the data model - rather than relying on having the original JSON representation Unicode - characters available.

    -

    - Since an object cannot have two properties with the same key, behavior for a - JSON document that tries to define two properties with - the same key in a single object is undefined.

    -

    - Note that JSON Schema vocabularies are free to define their own extended - type system. This should not be confused with the core data model types - defined here. As an example, "integer" is a reasonable type for a - vocabulary to define as a value for a keyword, but the data model - makes no distinction between integers and other numbers.

    -
    -
    -

    -4.2.2. Instance Equality -

    -

    - Two JSON instances are said to be equal if and only if they are of the same type - and have the same value according to the data model. Specifically, this means:

    -
      -
    • both are null; or -
    • -
    • both are true; or -
    • -
    • both are false; or -
    • -
    • both are strings, and are the same codepoint-for-codepoint; or -
    • -
    • both are numbers, and have the same mathematical value; or -
    • -
    • both are arrays, and have an equal value item-for-item; or -
    • -
    • both are objects, and each property in one has exactly one property with - a key equal to the other's, and that other property has an equal - value. -
    • -
    -

    - Implied in this definition is that arrays must be the same length, - objects must have the same number of members, - properties in objects are unordered, - there is no way to define multiple properties with the same key, - and mere formatting differences (indentation, placement of commas, trailing - zeros) are insignificant.

    -
    -
    -

    -4.2.3. Non-JSON Instances -

    -

    - It is possible to use JSON Schema with a superset of the JSON Schema data model, - where an instance may be outside any of the six JSON data types.

    -

    - In this case, annotations still apply; but most validation keywords will not be useful, - as they will always pass or always fail.

    -

    - A custom vocabulary may define support for a superset of the core data model. - The schema itself may only be expressible in this superset; - for example, to make use of the "const" keyword.

    -
    -
    -
    -
    -

    -4.3. JSON Schema Documents -

    -

    - A JSON Schema document, or simply a schema, is a JSON document used to describe - an instance. - A schema can itself be interpreted as an instance, but SHOULD always be given - the media type "application/schema+json" rather than - "application/schema-instance+json". The "application/schema+json" media - type is defined to offer a superset of the - fragment identifier syntax and semantics provided by - "application/schema-instance+json".

    -

    - A JSON Schema MUST be an object or a boolean.

    -
    -

    -4.3.1. JSON Schema Objects and Keywords -

    -

    - Object properties that are applied to the instance are called keywords, - or schema keywords. Broadly speaking, keywords fall into one - of five categories:

    -
    -
    identifiers:
    -
    - control schema identification through setting a URI - for the schema and/or changing how the base URI is determined -
    -
    -
    assertions:
    -
    - produce a boolean result when applied to an instance -
    -
    -
    annotations:
    -
    - attach information to an instance for application use -
    -
    -
    applicators:
    -
    - apply one or more subschemas to a particular location - in the instance, and combine or modify their results -
    -
    -
    reserved locations:
    -
    - do not directly affect results, but reserve a place - for a specific purpose to ensure interoperability -
    -
    -
    -

    - Keywords may fall into multiple categories, although applicators - SHOULD only produce assertion results based on their subschemas' - results. They should not define additional constraints independent - of their subschemas.

    -

    - Keywords which are properties within the same schema object are referred to as adjacent keywords.

    -

    - Extension keywords, meaning those defined outside of this document - and its companions, are free to define other behaviors as well.

    -

    - A JSON Schema MAY contain properties which are not schema keywords. - Unknown keywords SHOULD be treated as annotations, where the value - of the keyword is the value of the annotation.

    -

    - An empty schema is a JSON Schema with no properties, or only unknown - properties.

    -
    -
    -

    -4.3.2. Boolean JSON Schemas -

    -

    - The boolean schema values "true" and "false" are trivial schemas that - always produce themselves as assertion results, regardless of the - instance value. They never produce annotation results.

    -

    - These boolean schemas exist to clarify schema author intent and - facilitate schema processing optimizations. They behave identically - to the following schema objects (where "not" is part of the - subschema application vocabulary defined in this document).

    -
    -
    true:
    -
    - Always passes validation, as if the empty schema {} -
    -
    -
    false:
    -
    - Always fails validation, as if the schema { "not": {} } -
    -
    -
    -

    - While the empty schema object is unambiguous, there are many - possible equivalents to the "false" schema. Using the boolean - values ensures that the intent is clear to both human readers - and implementations.

    -
    -
    -

    -4.3.3. Schema Vocabularies -

    -

    - A schema vocabulary, or simply a vocabulary, is a set of keywords, - their syntax, and their semantics. A vocabulary is generally organized - around a particular purpose. Different uses of JSON Schema, such - as validation, hypermedia, or user interface generation, will - involve different sets of vocabularies.

    -

    - Vocabularies are the primary unit of re-use in JSON Schema, as schema - authors can indicate what vocabularies are required or optional in - order to process the schema. Since vocabularies are identified by URIs - in the meta-schema, generic implementations can load extensions to support - previously unknown vocabularies. While keywords can be supported outside - of any vocabulary, there is no analogous mechanism to indicate individual - keyword usage.

    -

    - A schema vocabulary can be defined by anything from an informal description - to a standards proposal, depending on the audience and interoperability - expectations. In particular, in order to facilitate vocabulary use within - non-public organizations, a vocabulary specification need not be published - outside of its scope of use.

    -
    -
    -

    -4.3.4. Meta-Schemas -

    -

    - A schema that itself describes a schema is called a meta-schema. - Meta-schemas are used to validate JSON Schemas and specify which vocabularies - they are using.

    -

    - Typically, a meta-schema will specify a set of vocabularies, and validate - schemas that conform to the syntax of those vocabularies. However, meta-schemas - and vocabularies are separate in order to allow meta-schemas to validate - schema conformance more strictly or more loosely than the vocabularies' - specifications call for. Meta-schemas may also describe and validate - additional keywords that are not part of a formal vocabulary.

    -
    -
    -
    -

    -4.3.5. Root Schema and Subschemas and Resources -

    -

    - A JSON Schema resource is a schema which is - canonically [RFC6596] identified by an - absolute URI [RFC3986]. Schema resources MAY - also be identified by URIs, including URIs with fragments, - if the resulting secondary resource (as defined by - section 3.5 of RFC 3986 [RFC3986]) is identical - to the primary resource. This can occur with the empty fragment, - or when one schema resource is embedded in another. Any such URIs - with fragments are considered to be non-canonical.

    -

    - The root schema is the schema that comprises the entire JSON document - in question. The root schema is always a schema resource, where the - URI is determined as described in section - 9.1.1. - - Note that documents that embed schemas in another format will not - have a root schema resource in this sense. Exactly how such usages - fit with the JSON Schema document and resource concepts will be - clarified in a future draft. -

    -

    - Some keywords take schemas themselves, allowing JSON Schemas to be nested:

    -
    -
    -
    -{
    -    "title": "root",
    -    "items": {
    -        "title": "array item"
    -    }
    -}
    -
    -
    -
    -

    - In this example document, the schema titled "array item" is a subschema, - and the schema titled "root" is the root schema.

    -

    - As with the root schema, a subschema is either an object or a boolean.

    -

    - As discussed in section - 8.2.1, a JSON Schema document - can contain multiple JSON Schema resources. When used without qualification, - the term "root schema" refers to the document's root schema. In some - cases, resource root schemas are discussed. A resource's root schema - is its top-level schema object, which would also be a document root schema - if the resource were to be extracted to a standalone JSON Schema document.

    -

    - Whether multiple schema resources are embedded or linked with a reference, - they are processed in the same way, with the same available behaviors.

    -
    -
    -
    -
    -
    -
    -
    -

    -5. Fragment Identifiers -

    -

    - In accordance with section 3.1 of RFC 6839 [RFC6839], - the syntax and semantics of fragment identifiers specified for - any +json media type SHOULD be as specified for "application/json". - (At publication of this document, there is no fragment identification - syntax defined for "application/json".)

    -

    - Additionally, the "application/schema+json" media type supports two - fragment identifier structures: plain names and JSON Pointers. - The "application/schema-instance+json" media type supports one - fragment identifier structure: JSON Pointers.

    -

    - The use of JSON Pointers as URI fragment identifiers is described in - RFC 6901 [RFC6901]. - For "application/schema+json", which supports two fragment identifier syntaxes, - fragment identifiers matching the JSON Pointer syntax, including the empty string, - MUST be interpreted as JSON Pointer fragment identifiers.

    -

    - Per the W3C's - best practices for fragment identifiers [W3C.WD-fragid-best-practices-20121025], - plain name fragment identifiers in "application/schema+json" are reserved for referencing - locally named schemas. All fragment identifiers that do - not match the JSON Pointer syntax MUST be interpreted as - plain name fragment identifiers.

    -

    - Defining and referencing a plain name fragment identifier within an - "application/schema+json" document are specified - in the "$anchor" keyword (Section 8.2.2) section.

    -

    -
    -
    -
    -

    -6. General Considerations -

    -
    -

    -6.1. Range of JSON Values -

    -

    - An instance may be any valid JSON value as defined by JSON [RFC8259]. - JSON Schema imposes no restrictions on type: JSON Schema can describe any JSON - value, including, for example, null.

    -
    -
    -
    -

    -6.2. Programming Language Independence -

    -

    - JSON Schema is programming language agnostic, and supports the full range of - values described in the data model. - Be aware, however, that some languages and JSON parsers may not be able to - represent in memory the full range of values describable by JSON.

    -
    -
    -
    -
    -

    -6.3. Mathematical Integers -

    -

    - Some programming languages and parsers use different internal representations - for floating point numbers than they do for integers.

    -

    - For consistency, integer JSON numbers SHOULD NOT be encoded with a fractional - part.

    -
    -
    -
    -
    -

    -6.4. Regular Expressions -

    -

    - Keywords MAY use regular expressions to express constraints, or constrain - the instance value to be a regular expression. - These regular expressions SHOULD be valid according to the regular expression - dialect described in ECMA-262, section 21.2.1 [ecma262].

    -

    - Regular expressions SHOULD be built with the "u" flag (or equivalent) to provide - Unicode support, or processed in such a way which provides Unicode support as - defined by ECMA-262.

    -

    - Furthermore, given the high disparity in regular expression constructs support, - schema authors SHOULD limit themselves to the following regular expression - tokens:

    -
      -
    • individual Unicode characters, as defined by the JSON specification [RFC8259]; -
    • -
    • simple character classes ([abc]), range character classes ([a-z]); -
    • -
    • complemented character classes ([^abc], [^a-z]); -
    • -
    • simple quantifiers: "+" (one or more), "*" (zero or more), "?" (zero or - one), and their lazy versions ("+?", "*?", "??"); -
    • -
    • range quantifiers: "{x}" (exactly x occurrences), "{x,y}" (at least x, at - most y, occurrences), {x,} (x occurrences or more), and their lazy - versions; -
    • -
    • the beginning-of-input ("^") and end-of-input ("$") anchors; -
    • -
    • simple grouping ("(...)") and alternation ("|"). -
    • -
    -

    - Finally, implementations MUST NOT take regular expressions to be - anchored, neither at the beginning nor at the end. This means, for instance, - the pattern "es" matches "expression".

    -
    -
    -
    -
    -

    -6.5. Extending JSON Schema -

    -

    - Additional schema keywords and schema vocabularies MAY be defined - by any entity. Save for explicit agreement, schema authors SHALL NOT - expect these additional keywords and vocabularies to be supported by - implementations that do not explicitly document such support. - Implementations SHOULD treat keywords they do not support as annotations, - where the value of the keyword is the value of the annotation.

    -

    - Implementations MAY provide the ability to register or load handlers - for vocabularies that they do not support directly. The exact mechanism - for registering and implementing such handlers is implementation-dependent.

    -
    -
    -
    -
    -

    -7. Keyword Behaviors -

    -

    - JSON Schema keywords fall into several general behavior categories. - Assertions validate that an instance satisfies constraints, producing - a boolean result. Annotations attach information that applications - may use in any way they see fit. - Applicators apply subschemas to parts of the instance and combine - their results.

    -

    - Extension keywords SHOULD stay within these categories, keeping in mind - that annotations in particular are extremely flexible. Complex behavior - is usually better delegated to applications on the basis of annotation - data than implemented directly as schema keywords. However, extension - keywords MAY define other behaviors for specialized purposes.

    -

    - Evaluating an instance against a schema involves processing all of the - keywords in the schema against the appropriate locations within the instance. - Typically, applicator keywords are processed until a schema object with no - applicators (and therefore no subschemas) is reached. The appropriate - location in the instance is evaluated against the assertion and - annotation keywords in the schema object, and their results are gathered - into the parent schema according to the rules of the applicator.

    -

    - Evaluation of a parent schema object can complete once all of its - subschemas have been evaluated, although in some circumstances evaluation - may be short-circuited due to assertion results. When annotations are - being collected, some assertion result short-circuiting is not possible - due to the need to examine all subschemas for annotation collection, including - those that cannot further change the assertion result.

    -
    -
    -

    -7.1. Lexical Scope and Dynamic Scope -

    -

    - While most JSON Schema keywords can be evaluated on their own, - or at most need to take into account the values or results of - adjacent keywords in the same schema object, a few have more - complex behavior.

    -

    - The lexical scope of a keyword is determined by the nested JSON - data structure of objects and arrays. The largest such scope - is an entire schema document. The smallest scope is a single - schema object with no subschemas.

    -

    - Keywords MAY be defined with a partial value, such as a URI-reference, - which must be resolved against another value, such as another - URI-reference or a full URI, which is found through the lexical - structure of the JSON document. The "$id", "$ref", and - "$dynamicRef" core keywords, and the "base" JSON Hyper-Schema - keyword, are examples of this sort of behavior.

    -

    - Note that some keywords, such as "$schema", apply to the lexical - scope of the entire schema resource, and therefore MUST only - appear in a schema resource's root schema.

    -

    - Other keywords may take into account the dynamic scope that - exists during the evaluation of a schema, typically together - with an instance document. - The outermost dynamic scope is the schema object at - which processing begins, even if it is not a schema resource root. - The path from this root schema to any particular keyword (that - includes any "$ref" and "$dynamicRef" keywords that may have - been resolved) is considered the keyword's "validation path."

    -

    - Lexical and dynamic scopes align until a reference keyword - is encountered. While following the reference keyword moves processing - from one lexical scope into a different one, from the perspective - of dynamic scope, following a reference is no different from descending - into a subschema present as a value. A keyword on the far side of - that reference that resolves information through the dynamic scope - will consider the originating side of the reference to be their - dynamic parent, rather than examining the local lexically enclosing parent.

    -

    - The concept of dynamic scope is primarily used with "$dynamicRef" and - "$dynamicAnchor", and should be considered an advanced feature - and used with caution when defining additional keywords. It also appears - when reporting errors and collected annotations, as it may be possible - to revisit the same lexical scope repeatedly with different dynamic - scopes. In such cases, it is important to inform the user of the - dynamic path that produced the error or annotation.

    -
    -
    -
    -

    -7.2. Keyword Interactions -

    -

    - Keyword behavior MAY be defined in terms of the annotation results - of subschemas (Section 4.3.5) and/or adjacent keywords - (keywords within the same schema object) and their subschemas. - Such keywords MUST NOT result in a circular dependency. - Keywords MAY modify their behavior based on the presence or absence - of another keyword in the same - schema object (Section 4.3).

    -
    -
    -

    -7.3. Default Behaviors -

    -

    - A missing keyword MUST NOT produce a false assertion result, MUST - NOT produce annotation results, and MUST NOT cause any other schema - to be evaluated as part of its own behavioral definition. - However, given that missing keywords do not contribute annotations, - the lack of annotation results may indirectly change the behavior - of other keywords.

    -

    - In some cases, the missing keyword assertion behavior of a keyword is - identical to that produced by a certain value, and keyword definitions - SHOULD note such values where known. However, even if the value which - produces the default behavior would produce annotation results if - present, the default behavior still MUST NOT result in annotations.

    -

    - Because annotation collection can add significant cost in terms of both - computation and memory, implementations MAY opt out of this feature. - Keywords that are specified in terms of collected annotations SHOULD - describe reasonable alternate approaches when appropriate. - This approach is demonstrated by the - "items" and - "additionalProperties" keywords in this - document.

    -

    - Note that when no such alternate approach is possible for a keyword, - implementations that do not support annotation collections will not - be able to support those keywords or vocabularies that contain them.

    -
    -
    -

    -7.4. Identifiers -

    -

    - Identifiers define URIs for a schema, or affect how such URIs are - resolved in references (Section 8.2.3), or both. - The Core vocabulary defined in this document defines several - identifying keywords, most notably "$id".

    -

    - Canonical schema URIs MUST NOT change while processing an instance, but - keywords that affect URI-reference resolution MAY have behavior that - is only fully determined at runtime.

    -

    - While custom identifier keywords are possible, vocabulary designers should - take care not to disrupt the functioning of core keywords. For example, - the "$dynamicAnchor" keyword in this specification limits its URI resolution - effects to the matching "$dynamicRef" keyword, leaving the behavior - of "$ref" undisturbed.

    -
    -
    -
    -

    -7.5. Applicators -

    -

    - Applicators allow for building more complex schemas than can be accomplished - with a single schema object. Evaluation of an instance against a - schema document (Section 4.3) begins by applying - the root schema (Section 4.3.5) to the complete instance - document. From there, keywords known as applicators are used to determine - which additional schemas are applied. Such schemas may be applied in-place - to the current location, or to a child location.

    -

    - The schemas to be applied may be present as subschemas comprising all or - part of the keyword's value. Alternatively, an applicator may refer to - a schema elsewhere in the same schema document, or in a different one. - The mechanism for identifying such referenced schemas is defined by the - keyword.

    -

    - Applicator keywords also define how subschema or referenced schema - boolean assertion (Section 7.6) - results are modified and/or combined to produce the boolean result - of the applicator. Applicators may apply any boolean logic operation - to the assertion results of subschemas, but MUST NOT introduce new - assertion conditions of their own.

    -

    - Annotation (Section 7.7) results are - preserved along with the instance location and the location of - the schema keyword, so that applications can decide how to - interpret multiple values.

    -
    -
    -

    -7.5.1. Referenced and Referencing Schemas -

    -

    - As noted in Section 7.5, an applicator keyword may - refer to a schema to be applied, rather than including it as a - subschema in the applicator's value. In such situations, the - schema being applied is known as the referenced schema, while - the schema containing the applicator keyword is the referencing schema.

    -

    - While root schemas and subschemas are static concepts based on a - schema's position within a schema document, referenced and referencing - schemas are dynamic. Different pairs of schemas may find themselves - in various referenced and referencing arrangements during the evaluation - of an instance against a schema.

    -

    - For some by-reference applicators, such as - "$ref" (Section 8.2.3.1), the referenced schema can be determined - by static analysis of the schema document's lexical scope. Others, - such as "$dynamicRef" (with "$dynamicAnchor"), may make use of dynamic - scoping, and therefore only be resolvable in the process of evaluating - the schema with an instance.

    -
    -
    -
    -
    -
    -
    -

    -7.6. Assertions -

    -

    - JSON Schema can be used to assert constraints on a JSON document, which - either passes or fails the assertions. This approach can be used to validate - conformance with the constraints, or document what is needed to satisfy them.

    -

    - JSON Schema implementations produce a single boolean result when evaluating - an instance against schema assertions.

    -

    - An instance can only fail an assertion that is present in the schema.

    -
    -

    -7.6.1. Assertions and Instance Primitive Types -

    -

    - Most assertions only constrain values within a certain - primitive type. When the type of the instance is not of the type - targeted by the keyword, the instance is considered to conform - to the assertion.

    -

    - For example, the "maxLength" keyword from the companion - validation vocabulary [json-schema-validation]: - will only restrict certain strings - (that are too long) from being valid. If the instance is a number, - boolean, null, array, or object, then it is valid against this assertion.

    -

    - This behavior allows keywords to be used more easily with instances - that can be of multiple primitive types. The companion validation - vocabulary also includes a "type" keyword which can independently - restrict the instance to one or more primitive types. This allows - for a concise expression of use cases such as a function that might - return either a string of a certain length or a null value:

    -
    -
    -
    -{
    -    "type": ["string", "null"],
    -    "maxLength": 255
    -}
    -
    -
    -
    -

    - If "maxLength" also restricted the instance type to be a string, - then this would be substantially more cumbersome to express because - the example as written would not actually allow null values. - Each keyword is evaluated separately unless explicitly specified - otherwise, so if "maxLength" restricted the instance to strings, - then including "null" in "type" would not have any useful effect.

    -
    -
    -
    -
    -
    -

    -7.7. Annotations -

    -

    - JSON Schema can annotate an instance with information, whenever the instance - validates against the schema object containing the annotation, and all of its - parent schema objects. The information can be a simple value, or can be - calculated based on the instance contents.

    -

    - Annotations are attached to specific locations in an instance. - Since many subschemas can be applied to any single - location, applications may need to decide how to handle differing - annotation values being attached to the same instance location by - the same schema keyword in different schema objects.

    -

    - Unlike assertion results, annotation data can take a wide variety of forms, - which are provided to applications to use as they see fit. JSON Schema - implementations are not expected to make use of the collected information - on behalf of applications.

    -

    - Unless otherwise specified, the value of an annotation keyword - is the keyword's value. However, other behaviors are possible. - For example, JSON Hyper-Schema's [json-hyper-schema] - "links" keyword is a complex annotation that produces a value based - in part on the instance data.

    -

    - While "short-circuit" evaluation is possible for assertions, collecting - annotations requires examining all schemas that apply to an instance - location, even if they cannot change the overall assertion result. - The only exception is that subschemas of a schema object that has - failed validation MAY be skipped, as annotations are not retained - for failing schemas.

    -
    -

    -7.7.1. Collecting Annotations -

    -

    - Annotations are collected by keywords that explicitly define - annotation-collecting behavior. Note that boolean schemas cannot - produce annotations as they do not make use of keywords.

    -

    - A collected annotation MUST include the following information:

    -
      -
    • - The name of the keyword that produces the annotation -
    • -
    • - The instance location to which it is attached, as a JSON Pointer -
    • -
    • - The schema location path, indicating how reference keywords - such as "$ref" were followed to reach the absolute schema location. -
    • -
    • - The absolute schema location of the attaching keyword, as a URI. - This MAY be omitted if it is the same as the schema location path - from above. -
    • -
    • - The attached value(s) -
    • -
    -
    -
    -7.7.1.1. Distinguishing Among Multiple Values -
    -

    - Applications MAY make decisions on which of multiple annotation values - to use based on the schema location that contributed the value. - This is intended to allow flexible usage. Collecting the schema location - facilitates such usage.

    -

    - For example, consider this schema, which uses annotations and assertions from - the Validation specification [json-schema-validation]:

    -

    - Note that some lines are wrapped for clarity.

    -
    -
    -
    -{
    -    "title": "Feature list",
    -    "type": "array",
    -    "prefixItems": [
    -        {
    -            "title": "Feature A",
    -            "properties": {
    -                "enabled": {
    -                    "$ref": "#/$defs/enabledToggle",
    -                    "default": true
    -                }
    -            }
    -        },
    -        {
    -            "title": "Feature B",
    -            "properties": {
    -                "enabled": {
    -                    "description": "If set to null, Feature B
    -                                    inherits the enabled
    -                                    value from Feature A",
    -                    "$ref": "#/$defs/enabledToggle"
    -                }
    -            }
    -        }
    -    ],
    -    "$defs": {
    -        "enabledToggle": {
    -            "title": "Enabled",
    -            "description": "Whether the feature is enabled (true),
    -                            disabled (false), or under
    -                            automatic control (null)",
    -            "type": ["boolean", "null"],
    -            "default": null
    -        }
    -    }
    -}
    -
    -
    -
    -

    - In this example, both Feature A and Feature B make use of the re-usable - "enabledToggle" schema. That schema uses the "title", "description", - and "default" annotations. Therefore the application has to decide how - to handle the additional "default" value for Feature A, and the additional - "description" value for Feature B.

    -

    - The application programmer and the schema author need to agree on the - usage. For this example, let's assume that they agree that the most - specific "default" value will be used, and any additional, more generic - "default" values will be silently ignored. Let's also assume that they - agree that all "description" text is to be used, starting with the most - generic, and ending with the most specific. This requires the schema - author to write descriptions that work when combined in this way.

    -

    - The application can use the schema location path to determine which - values are which. The values in the feature's immediate "enabled" - property schema are more specific, while the values under the re-usable - schema that is referenced to with "$ref" are more generic. The schema - location path will show whether each value was found by crossing a - "$ref" or not.

    -

    - Feature A will therefore use a default value of true, while Feature B - will use the generic default value of null. Feature A will only - have the generic description from the "enabledToggle" schema, while - Feature B will use that description, and also append its locally - defined description that explains how to interpret a null value.

    -

    - Note that there are other reasonable approaches that a different application - might take. For example, an application may consider the presence of - two different values for "default" to be an error, regardless of their - schema locations.

    -
    -
    -
    -7.7.1.2. Annotations and Assertions -
    -

    - Schema objects that produce a false assertion result MUST NOT - produce any annotation results, whether from their own keywords - or from keywords in subschemas.

    -

    - Note that the overall schema results may still include annotations - collected from other schema locations. Given this schema:

    -
    -
    -
    -{
    -    "oneOf": [
    -        {
    -            "title": "Integer Value",
    -            "type": "integer"
    -        },
    -        {
    -            "title": "String Value",
    -            "type": "string"
    -        }
    -    ]
    -}
    -
    -
    -
    -

    - Against the instance "This is a string", the - title annotation "Integer Value" is discarded because the type assertion - in that schema object fails. The title annotation "String Value" - is kept, as the instance passes the string type assertions.

    -
    -
    -
    -7.7.1.3. Annotations and Applicators -
    -

    - In addition to possibly defining annotation results of their own, - applicator keywords aggregate the annotations collected in their - subschema(s) or referenced schema(s).

    -
    -
    -
    -
    -
    -

    -7.8. Reserved Locations -

    -

    - A fourth category of keywords simply reserve a location to hold re-usable - components or data of interest to schema authors that is not suitable - for re-use. These keywords do not affect validation or annotation results. - Their purpose in the core vocabulary is to ensure that locations are - available for certain purposes and will not be redefined by extension - keywords.

    -

    - While these keywords do not directly affect results, as explained in section - 9.4.2 unrecognized - extension keywords that reserve locations for re-usable schemas may have - undesirable interactions with references in certain circumstances.

    -
    -
    -

    -7.9. Loading Instance Data -

    -

    - While none of the vocabularies defined as part of this or the associated documents - define a keyword which may target and/or load instance data, it is possible that - other vocabularies may wish to do so.

    -

    - Keywords MAY be defined to use JSON Pointers or Relative JSON Pointers to examine - parts of an instance outside the current evaluation location.

    -

    - Keywords that allow adjusting the location using a Relative JSON Pointer SHOULD - default to using the current location if a default is desireable.

    -
    -
    -
    -

    -8. The JSON Schema Core Vocabulary -

    -

    - Keywords declared in this section, which all begin with "$", make up - the JSON Schema Core vocabulary. These keywords are either required in - order to process any schema or meta-schema, including those split across - multiple documents, or exist to reserve keywords for purposes that - require guaranteed interoperability.

    -

    - The Core vocabulary MUST be considered mandatory at all times, in order - to bootstrap the processing of further vocabularies. Meta-schemas - that use the "$vocabulary" (Section 8.1) keyword - to declare the vocabularies in use MUST explicitly list the Core vocabulary, - which MUST have a value of true indicating that it is required.

    -

    - The behavior of a false value for this vocabulary (and only this - vocabulary) is undefined, as is the behavior when "$vocabulary" - is present but the Core vocabulary is not included. However, it - is RECOMMENDED that implementations detect these cases and raise - an error when they occur. It is not meaningful to declare that - a meta-schema optionally uses Core.

    -

    - Meta-schemas that do not use "$vocabulary" MUST be considered to - require the Core vocabulary as if its URI were present with a value of true.

    -

    - The current URI for the Core vocabulary is: - <https://json-schema.org/draft/2020-12/vocab/core>.

    -

    - The current URI for the corresponding meta-schema is: - https://json-schema.org/draft/2020-12/meta/core.

    -

    - While the "$" prefix is not formally reserved for the Core vocabulary, - it is RECOMMENDED that extension keywords (in vocabularies or otherwise) - begin with a character other than "$" to avoid possible future collisions.

    -
    -
    -

    -8.1. Meta-Schemas and Vocabularies -

    -

    - Two concepts, meta-schemas and vocabularies, are used to inform an implementation - how to interpret a schema. Every schema has a meta-schema, which can be declared - using the "$schema" keyword.

    -

    - The meta-schema serves two purposes:

    -
    -
    Declaring the vocabularies in use
    -
    - The "$vocabulary" keyword, when it appears in a meta-schema, declares - which vocabularies are available to be used in schemas that refer - to that meta-schema. Vocabularies define keyword semantics, - as well as their general syntax. -
    -
    -
    Describing valid schema syntax
    -
    - A schema MUST successfully validate against its meta-schema, which - constrains the syntax of the available keywords. The syntax described - is expected to be compatible with the vocabularies declared; while - it is possible to describe an incompatible syntax, such a meta-schema - would be unlikely to be useful. -
    -
    -
    -

    - Meta-schemas are separate from vocabularies to allow for - vocabularies to be combined in different ways, and for meta-schema authors - to impose additional constraints such as forbidding certain keywords, or - performing unusually strict syntactical validation, as might be done - during a development and testing cycle. Each vocabulary typically identifies - a meta-schema consisting only of the vocabulary's keywords.

    -

    - Meta-schema authoring is an advanced usage of JSON Schema, so the design of - meta-schema features emphasizes flexibility over simplicity.

    -
    -
    -

    -8.1.1. The "$schema" Keyword -

    -

    - The "$schema" keyword is both used as a JSON Schema dialect identifier and - as the identifier of a resource which is itself a JSON Schema, which describes the - set of valid schemas written for this particular dialect.

    -

    - The value of this keyword MUST be a URI [RFC3986] - (containing a scheme) and this URI MUST be normalized. - The current schema MUST be valid against the meta-schema identified by this URI.

    -

    - If this URI identifies a retrievable resource, that resource SHOULD be of - media type "application/schema+json".

    -

    - The "$schema" keyword SHOULD be used in the document root schema object, - and MAY be used in the root schema objects of embedded schema resources. - It MUST NOT appear in non-resource root schema objects. If absent from - the document root schema, the resulting behavior is implementation-defined.

    -

    - Values for this property are defined elsewhere in this and other documents, - and by other parties.

    -
    -
    -
    -

    -8.1.2. The "$vocabulary" Keyword -

    -

    - The "$vocabulary" keyword is used in meta-schemas to identify the - vocabularies available for use in schemas described by that meta-schema. - It is also used to indicate whether each vocabulary is required or optional, - in the sense that an implementation MUST understand the required vocabularies - in order to successfully process the schema. Together, this information forms - a dialect. Any vocabulary that is understood by the implementation MUST be - processed in a manner consistent with the semantic definitions contained - within the vocabulary.

    -

    - The value of this keyword MUST be an object. The property names in the - object MUST be URIs (containing a scheme) and this URI MUST be normalized. - Each URI that appears as a property name identifies a specific set of - keywords and their semantics.

    -

    - The URI MAY be a URL, but the nature of the retrievable resource is - currently undefined, and reserved for future use. Vocabulary authors - MAY use the URL of the vocabulary specification, in a human-readable - media type such as text/html or text/plain, as the vocabulary URI. - - Vocabulary documents may be added in forthcoming drafts. - For now, identifying the keyword set is deemed sufficient as that, - along with meta-schema validation, is how the current "vocabularies" - work today. Any future vocabulary document format will be specified - as a JSON document, so using text/html or other non-JSON formats - in the meantime will not produce any future ambiguity. -

    -

    - The values of the object properties MUST be booleans. - If the value is true, then implementations that do not recognize - the vocabulary MUST refuse to process any schemas that declare - this meta-schema with "$schema". If the value is false, implementations - that do not recognize the vocabulary SHOULD proceed with processing - such schemas. The value has no impact if the implementation - understands the vocabulary.

    -

    - Per 6.5, unrecognized - keywords SHOULD be treated as annotations. - This remains the case for keywords defined - by unrecognized vocabularies. It is not currently possible to distinguish - between unrecognized keywords that are defined in vocabularies from - those that are not part of any vocabulary.

    -

    - The "$vocabulary" keyword SHOULD be used in the root schema of any schema - document intended for use as a meta-schema. It MUST NOT appear in subschemas.

    -

    - The "$vocabulary" keyword MUST be ignored in schema documents that - are not being processed as a meta-schema. This allows validating - a meta-schema M against its own meta-schema M' without requiring - the validator to understand the vocabularies declared by M.

    -
    -
    -8.1.2.1. Default vocabularies -
    -

    - If "$vocabulary" is absent, an implementation MAY determine - behavior based on the meta-schema if it is recognized from the - URI value of the referring schema's "$schema" keyword. - This is how behavior (such as Hyper-Schema usage) has been - recognized prior to the existence of vocabularies.

    -

    - If the meta-schema, as referenced by the schema, is not recognized, - or is missing, then the behavior is implementation-defined. - If the implementation - proceeds with processing the schema, it MUST assume the use of the - core vocabulary. If the implementation is built for a specific purpose, - then it SHOULD assume the use of all of the most relevant vocabularies - for that purpose.

    -

    - For example, an implementation that is a validator - SHOULD assume the use of all vocabularies in this - specification and the companion Validation specification.

    -
    -
    -
    -8.1.2.2. Non-inheritability of vocabularies -
    -

    - Note that the processing restrictions on "$vocabulary" mean that - meta-schemas that reference other meta-schemas using "$ref" or - similar keywords do not automatically inherit the vocabulary - declarations of those other meta-schemas. All such declarations - must be repeated in the root of each schema document intended - for use as a meta-schema. This is demonstrated in - the example meta-schema (Appendix D.2). - - This requirement allows implementations to find all vocabulary - requirement information in a single place for each meta-schema. - As schema extensibility means that there are endless potential - ways to combine more fine-grained meta-schemas by reference, - requiring implementations to anticipate all possibilities and - search for vocabularies in referenced meta-schemas would - be overly burdensome. -

    -
    -
    -
    -

    -8.1.3. Updates to Meta-Schema and Vocabulary URIs -

    -

    - Updated vocabulary and meta-schema URIs MAY be published between - specification drafts in order to correct errors. Implementations - SHOULD consider URIs dated after this specification draft and - before the next to indicate the same syntax and semantics - as those listed here.

    -
    -
    -
    -
    -

    -8.2. Base URI, Anchors, and Dereferencing -

    -

    - To differentiate between schemas in a vast ecosystem, schemas are - identified by URI [RFC3986], and can embed references - to other schemas by specifying their URI.

    -

    - Several keywords can accept a relative URI-reference [RFC3986], - or a value used to construct a relative URI-reference. For these keywords, - it is necessary to establish a base URI in order to resolve the reference.

    -
    -
    -

    -8.2.1. The "$id" Keyword -

    -

    - The "$id" keyword identifies a schema resource with its - canonical [RFC6596] URI.

    -

    - Note that this URI is an identifier and not necessarily a network locator. - In the case of a network-addressable URL, a schema need not be downloadable - from its canonical URI.

    -

    - If present, the value for this keyword MUST be a string, and MUST represent a - valid URI-reference [RFC3986]. This URI-reference - SHOULD be normalized, and MUST resolve to an - absolute-URI [RFC3986] (without a fragment), - or to a URI with an empty fragment.

    -

    - The empty fragment form is NOT RECOMMENDED and is retained only - for backwards compatibility, and because the - application/schema+json media type defines that a URI with an - empty fragment identifies the same resource as the same URI - with the fragment removed. However, since this equivalence is not - part of the RFC 3986 normalization process [RFC3986], - implementers and schema authors cannot rely on generic URI libraries - understanding it.

    -

    - Therefore, "$id" MUST NOT contain a non-empty fragment, and SHOULD NOT - contain an empty fragment. The absolute-URI form MUST be considered - the canonical URI, regardless of the presence or absence of an empty fragment. - - An empty fragment is currently allowed because older meta-schemas have - an empty fragment in their $id (or previously, id). - A future draft may outright forbid even empty fragments in "$id". -

    -

    - The absolute-URI also serves as the base URI for relative URI-references - in keywords within the schema resource, in accordance with - RFC 3986 section 5.1.1 [RFC3986] regarding base URIs - embedded in content.

    -

    - The presence of "$id" in a subschema indicates that the subschema constitutes - a distinct schema resource within a single schema document. Furthermore, - in accordance with RFC 3986 section 5.1.2 [RFC3986] - regarding encapsulating entities, if an "$id" in a subschema is a relative - URI-reference, the base URI for resolving that reference is the URI of - the parent schema resource.

    -

    - If no parent schema object explicitly identifies itself as a resource - with "$id", the base URI is that of the entire document, as established - by the steps given in the previous section. (Section 9.1.1)

    -
    -
    -8.2.1.1. Identifying the root schema -
    -

    - The root schema of a JSON Schema document SHOULD contain an "$id" keyword - with an absolute-URI [RFC3986] (containing a scheme, - but no fragment).

    -
    -
    -
    -
    -
    -

    -8.2.2. Defining location-independent identifiers -

    -

    - Using JSON Pointer fragments requires knowledge of the structure of the schema. - When writing schema documents with the intention to provide re-usable - schemas, it may be preferable to use a plain name fragment that is not tied to - any particular structural location. This allows a subschema to be relocated - without requiring JSON Pointer references to be updated.

    -

    - The "$anchor" and "$dynamicAnchor" keywords are used to specify such - fragments. They are identifier keywords that can only be used to create - plain name fragments, rather than absolute URIs as seen with "$id".

    -

    - The base URI to which the resulting fragment is appended is the canonical - URI of the schema resource containing the "$anchor" or "$dynamicAnchor" - in question. As discussed in the previous section, this is either the - nearest "$id" in the same or parent schema object, or the base URI - for the document as determined according to RFC 3986.

    -

    - Separately from the usual usage of URIs, "$dynamicAnchor" - indicates that the fragment is an extension point when used with - the "$dynamicRef" keyword. This low-level, advanced feature - makes it easier to extend recursive schemas such as the meta-schemas, - without imposing any particular semantics on that extension. - See the section on "$dynamicRef" (Section 8.2.3.2) - for details.

    -

    - In most cases, the normal fragment behavior both suffices and - is more intuitive. Therefore it is RECOMMENDED that "$anchor" - be used to create plain name fragments unless there is a clear - need for "$dynamicAnchor".

    -

    - If present, the value of this keyword MUST be a string and MUST start with - a letter ([A-Za-z]) or underscore ("_"), followed by any number of letters, - digits ([0-9]), hyphens ("-"), underscores ("_"), and periods ("."). - This matches the US-ASCII part of XML's - NCName production [xml-names]. - - Note that the anchor string does not include the "#" character, - as it is not a URI-reference. An "$anchor": "foo" becomes the - fragment "#foo" when used in a URI. See below for full examples. -

    -

    - The effect of specifying the same fragment name multiple times within - the same resource, using any combination of "$anchor" and/or - "$dynamicAnchor", is undefined. Implementations MAY - raise an error if such usage is detected.

    -
    -
    -
    -
    -

    -8.2.3. Schema References -

    -

    - Several keywords can be used to reference a schema which is to be applied to the - current instance location. "$ref" and "$dynamicRef" are applicator - keywords, applying the referenced schema to the instance.

    -

    - As the values of "$ref" and "$dynamicRef" are URI References, this allows - the possibility to externalise or divide a schema across multiple files, - and provides the ability to validate recursive structures through - self-reference.

    -

    - The resolved URI produced by these keywords is not necessarily a network - locator, only an identifier. A schema need not be downloadable from the - address if it is a network-addressable URL, and implementations SHOULD NOT - assume they should perform a network operation when they encounter - a network-addressable URI.

    -
    -
    -
    -8.2.3.1. Direct References with "$ref" -
    -

    - The "$ref" keyword is an applicator that is used to reference a statically - identified schema. Its results are the results of the referenced schema. - - Note that this definition of how the results are determined means that - other keywords can appear alongside of "$ref" in the same schema object. -

    -

    - The value of the "$ref" keyword MUST be a string which is a URI-Reference. - Resolved against the current URI base, it produces the URI of the schema - to apply. This resolution is safe to perform on schema load, as the - process of evaluating an instance cannot change how the reference resolves.

    -
    -
    -
    -
    -
    -8.2.3.2. Dynamic References with "$dynamicRef" -
    -

    - The "$dynamicRef" keyword is an applicator that allows for deferring the - full resolution until runtime, at which point it is resolved each time it is - encountered while evaluating an instance.

    -

    - Together with "$dynamicAnchor", "$dynamicRef" implements a cooperative - extension mechanism that is primarily useful with recursive schemas - (schemas that reference themselves). Both the extension point and the - runtime-determined extension target are defined with "$dynamicAnchor", - and only exhibit runtime dynamic behavior when referenced with - "$dynamicRef".

    -

    - The value of the "$dynamicRef" property MUST be a string which is - a URI-Reference. Resolved against the current URI base, it produces - the URI used as the starting point for runtime resolution. This initial - resolution is safe to perform on schema load.

    -

    - If the initially resolved starting point URI includes a fragment that - was created by the "$dynamicAnchor" keyword, the initial URI MUST be - replaced by the URI (including the fragment) for the outermost schema - resource in the dynamic scope (Section 7.1) that defines - an identically named fragment with "$dynamicAnchor".

    -

    - Otherwise, its behavior is identical to "$ref", and no runtime - resolution is needed.

    -

    - For a full example using these keyword, see appendix - C. - - The difference between the hyper-schema meta-schema in pre-2019 - drafts and an this draft dramatically demonstrates the utility - of these keywords. -

    -
    -
    -
    -
    -
    -
    -

    -8.2.4. Schema Re-Use With "$defs" -

    -

    - The "$defs" keyword reserves a location for schema - authors to inline re-usable JSON Schemas into a more general schema. - The keyword does not directly affect the validation result.

    -

    - This keyword's value MUST be an object. - Each member value of this object MUST be a valid JSON Schema.

    -

    - As an example, here is a schema describing an array of positive - integers, where the positive integer constraint is a subschema in - "$defs":

    -
    -
    -
    -{
    -    "type": "array",
    -    "items": { "$ref": "#/$defs/positiveInteger" },
    -    "$defs": {
    -        "positiveInteger": {
    -            "type": "integer",
    -            "exclusiveMinimum": 0
    -        }
    -    }
    -}
    -
    -
    -
    -
    -
    -
    -
    -

    -8.3. Comments With "$comment" -

    -

    - This keyword reserves a location for comments from schema authors - to readers or maintainers of the schema.

    -

    - The value of this keyword MUST be a string. Implementations MUST NOT present this - string to end users. Tools for editing schemas SHOULD support displaying and - editing this keyword. The value of this keyword MAY be used in debug or error - output which is intended for developers making use of schemas.

    -

    - Schema vocabularies SHOULD allow "$comment" within any object containing - vocabulary keywords. Implementations MAY assume "$comment" is allowed - unless the vocabulary specifically forbids it. Vocabularies MUST NOT - specify any effect of "$comment" beyond what is described in this - specification.

    -

    - Tools that translate other media types or programming languages - to and from application/schema+json MAY choose to convert that media type or - programming language's native comments to or from "$comment" values. - The behavior of such translation when both native comments and "$comment" - properties are present is implementation-dependent.

    -

    - Implementations MAY strip "$comment" values at any point during processing. - In particular, this allows for shortening schemas when the size of deployed - schemas is a concern.

    -

    - Implementations MUST NOT take any other action based on the presence, absence, - or contents of "$comment" properties. In particular, the value of "$comment" - MUST NOT be collected as an annotation result.

    -
    -
    -
    -

    -9. Loading and Processing Schemas -

    -

    -
    -

    -9.1. Loading a Schema -

    -
    -
    -

    -9.1.1. Initial Base URI -

    -

    - RFC3986 Section 5.1 [RFC3986] defines how to determine the - default base URI of a document.

    -

    - Informatively, the initial base URI of a schema is the URI at which it was - found, whether that was a network location, a local filesystem, or any other - situation identifiable by a URI of any known scheme.

    -

    - If a schema document defines no explicit base URI with "$id" - (embedded in content), the base URI is that determined per - RFC 3986 section 5 [RFC3986].

    -

    - If no source is known, or no URI scheme is known for the source, a suitable - implementation-specific default URI MAY be used as described in - RFC 3986 Section 5.1.4 [RFC3986]. It is RECOMMENDED - that implementations document any default base URI that they assume.

    -

    - If a schema object is embedded in a document of another media type, then - the initial base URI is determined according to the rules of that - media type.

    -

    - Unless the "$id" keyword described in an earlier section is present in the - root schema, this base URI SHOULD be considered the canonical URI of the - schema document's root schema resource.

    -
    -
    -
    -

    -9.1.2. Loading a referenced schema -

    -

    - The use of URIs to identify remote schemas does not necessarily mean anything is downloaded, - but instead JSON Schema implementations SHOULD understand ahead of time which schemas they will be using, - and the URIs that identify them.

    -

    - When schemas are downloaded, - for example by a generic user-agent that does not know until runtime which schemas to download, - see Usage for Hypermedia (Section 9.5.1).

    -

    - Implementations SHOULD be able to associate arbitrary URIs with an arbitrary - schema and/or automatically associate a schema's "$id"-given URI, depending - on the trust that the validator has in the schema. Such URIs and schemas - can be supplied to an implementation prior to processing instances, or may - be noted within a schema document as it is processed, producing associations - as shown in appendix A.

    -

    - A schema MAY (and likely will) have multiple URIs, but there is no way for a - URI to identify more than one schema. When multiple schemas try to identify - as the same URI, validators SHOULD raise an error condition.

    -
    -
    -

    -9.1.3. Detecting a Meta-Schema -

    -

    - Implementations MUST recognize a schema as a meta-schema if it - is being examined because it was identified as such by another - schema's "$schema" keyword. This means that a single schema - document might sometimes be considered a regular schema, and - other times be considered a meta-schema.

    -

    - In the case of examining a schema which is its own meta-schema, - when an implementation begins processing it as a regular schema, - it is processed under those rules. However, when loaded a second - time as a result of checking its own "$schema" value, it is treated - as a meta-schema. So the same document is processed both ways in - the course of one session.

    -

    - Implementations MAY allow a schema to be explicitly passed as a meta-schema, - for implementation-specific purposes, such as pre-loading a commonly - used meta-schema and checking its vocabulary support requirements - up front. Meta-schema authors MUST NOT expect such features to be - interoperable across implementations.

    -
    -
    -
    -

    -9.2. Dereferencing -

    -

    - Schemas can be identified by any URI that has been given to them, including - a JSON Pointer or their URI given directly by "$id". In all cases, - dereferencing a "$ref" reference involves first resolving its value as a - URI reference against the current base URI per - RFC 3986 [RFC3986].

    -

    - If the resulting URI identifies a schema within the current document, or - within another schema document that has been made available to the implementation, - then that schema SHOULD be used automatically.

    -

    - For example, consider this schema:

    -
    -
    -
    -{
    -    "$id": "https://example.net/root.json",
    -    "items": {
    -        "type": "array",
    -        "items": { "$ref": "#item" }
    -    },
    -    "$defs": {
    -        "single": {
    -            "$anchor": "item",
    -            "type": "object",
    -            "additionalProperties": { "$ref": "other.json" }
    -        }
    -    }
    -}
    -
    -
    -
    -

    - When an implementation encounters the <#/$defs/single> schema, - it resolves the "$anchor" value as a fragment name against the current - base URI to form <https://example.net/root.json#item>.

    -

    - When an implementation then looks inside the <#/items> schema, it - encounters the <#item> reference, and resolves this to - <https://example.net/root.json#item>, which it has seen defined in - this same document and can therefore use automatically.

    -

    - When an implementation encounters the reference to "other.json", it resolves - this to <https://example.net/other.json>, which is not defined in this - document. If a schema with that identifier has otherwise been supplied to - the implementation, it can also be used automatically. - - What should implementations do when the referenced schema is not known? - Are there circumstances in which automatic network dereferencing is - allowed? A same origin policy? A user-configurable option? In the - case of an evolving API described by Hyper-Schema, it is expected that - new schemas will be added to the system dynamically, so placing an - absolute requirement of pre-loading schema documents is not feasible. -

    -
    -
    -

    -9.2.1. JSON Pointer fragments and embedded schema resources -

    -

    - Since JSON Pointer URI fragments are constructed based on the structure - of the schema document, an embedded schema resource and its subschemas - can be identified by JSON Pointer fragments relative to either its own - canonical URI, or relative to any containing resource's URI.

    -

    - Conceptually, a set of linked schema resources should behave - identically whether each resource is a separate document connected with - schema references (Section 8.2.3), or is structured as - a single document with one or more schema resources embedded as - subschemas.

    -

    - Since URIs involving JSON Pointer fragments relative to the parent - schema resource's URI cease to be valid when the embedded schema - is moved to a separate document and referenced, applications and schemas - SHOULD NOT use such URIs to identify embedded schema resources or - locations within them.

    -

    - Consider the following schema document that contains another - schema resource embedded within it:

    -
    -
    -
    -{
    -    "$id": "https://example.com/foo",
    -    "items": {
    -        "$id": "https://example.com/bar",
    -        "additionalProperties": { }
    -    }
    -}
    -
    -
    -
    -

    - The URI "https://example.com/foo#/items" points to the "items" schema, - which is an embedded resource. The canonical URI of that schema - resource, however, is "https://example.com/bar".

    -

    - For the "additionalProperties" schema within that embedded resource, - the URI "https://example.com/foo#/items/additionalProperties" points - to the correct object, but that object's URI relative to its resource's - canonical URI is "https://example.com/bar#/additionalProperties".

    -

    - Now consider the following two schema resources linked by reference - using a URI value for "$ref":

    -
    -
    -
    -{
    -    "$id": "https://example.com/foo",
    -    "items": {
    -        "$ref": "bar"
    -    }
    -}
    -
    -{
    -    "$id": "https://example.com/bar",
    -    "additionalProperties": { }
    -}
    -
    -
    -
    -

    - Here we see that "https://example.com/bar#/additionalProperties", - using a JSON Pointer fragment appended to the canonical URI of - the "bar" schema resource, is still valid, while - "https://example.com/foo#/items/additionalProperties", which relied - on a JSON Pointer fragment appended to the canonical URI of the - "foo" schema resource, no longer resolves to anything.

    -

    - Note also that "https://example.com/foo#/items" is valid in both - arrangements, but resolves to a different value. This URI ends up - functioning similarly to a retrieval URI for a resource. While this URI - is valid, it is more robust to use the "$id" of the embedded or referenced - resource unless it is specifically desired to identify the object containing - the "$ref" in the second (non-embedded) arrangement.

    -

    - An implementation MAY choose not to support addressing schema resource - contents by URIs using a base other than the resource's canonical URI, - plus a JSON Pointer fragment relative to that base. Therefore, schema - authors SHOULD NOT rely on such URIs, as using them may reduce interoperability. - - This is to avoid requiring implementations to keep track of a whole - stack of possible base URIs and JSON Pointer fragments for each, - given that all but one will be fragile if the schema resources - are reorganized. Some - have argued that this is easy so there is - no point in forbidding it, while others have argued that it complicates - schema identification and should be forbidden. Feedback on this - topic is encouraged. - After some discussion, we feel that we need to remove the use of - "canonical" in favour of talking about JSON Pointers which reference - across schema resource boundaries as undefined or even forbidden behavior - (https://github.com/json-schema-org/json-schema-spec/issues/937, - https://github.com/json-schema-org/json-schema-spec/issues/1183) -

    -

    - Further examples of such non-canonical URI construction, as well as - the appropriate canonical URI-based fragments to use instead, - are provided in appendix A.

    -
    -
    -
    -
    -

    -9.3. Compound Documents -

    -

    - A Compound Schema Document is defined as a JSON document (sometimes called a "bundled" schema) - which has multiple embedded JSON Schema Resources bundled into the same document to - ease transportation.

    -

    - Each embedded Schema Resource MUST be treated as an individual Schema Resource, following standard - schema loading and processing requirements, including determining vocabulary support.

    -
    -

    -9.3.1. Bundling -

    -

    - The bundling process for creating a Compound Schema Document is defined as taking - references (such as "$ref") to an external Schema Resource and embedding the referenced - Schema Resources within the referring document. Bundling SHOULD be done in such a way that - all URIs (used for referencing) in the base document and any referenced/embedded - documents do not require altering.

    -

    - Each embedded JSON Schema Resource MUST identify itself with a URI using the "$id" keyword, - and SHOULD make use of the "$schema" keyword to identify the dialect it is using, in the root of the - schema resource. It is RECOMMENDED that the URI identifier value of "$id" be an Absolute URI.

    -

    - When the Schema Resource referenced by a by-reference applicator is bundled, it is RECOMMENDED that - the Schema Resource be located as a value of a "$defs" object at the containing schema's root. - The key of the "$defs" for the now embedded Schema Resource MAY be the "$id" of the bundled schema - or some other form of application defined unique identifer (such as a UUID). This key is not - intended to be referenced in JSON Schema, but may be used by an application to aid the - bundling process.

    -

    - A Schema Resource MAY be embedded in a location other than "$defs" where the location is defined - as a schema value.

    -

    - A Bundled Schema Resource MUST NOT be bundled by replacing the schema object from which it was - referenced, or by wrapping the Schema Resource in other applicator keywords.

    -

    - In order to produce identical output, references in the containing schema document to the - previously external Schema Resources MUST NOT be changed, and now resolve to a schema using the - "$id" of an embedded Schema Resource. Such identical output includes validation evaluation and URIs - or paths used in resulting annotations or errors.

    -

    - While the bundling process will often be the main method for creating a Compound Schema Document, - it is also possible and expected that some will be created by hand, potentially without individual - Schema Resources existing on their own previously.

    -
    -
    -

    -9.3.2. Differing and Default Dialects -

    -

    - When multiple schema resources are present in a single document, - schema resources which do not define with which dialect they should be processed - MUST be processed with the same dialect as the enclosing resource.

    -

    - Since any schema that can be referenced can also be embedded, embedded schema resources MAY - specify different processing dialects using the "$schema" values from their enclosing resource.

    -
    -
    -

    -9.3.3. Validating -

    -

    - Given that a Compound Schema Document may have embedded resources which identify as using different - dialects, these documents SHOULD NOT be validated by applying a meta-schema - to the Compound Schema Document as an instance. It is RECOMMENDED that an alternate - validation process be provided in order to validate Schema Documents. Each Schema Resource - SHOULD be separately validated against its associated meta-schema. - - If you know a schema is what's being validated, you can identify if the schemas - is a Compound Schema Document or not, by way of use of "$id", which identifies an - embedded resource when used not at the document's root. -

    -

    - A Compound Schema Document in which all embedded resources identify as using the same - dialect, or in which "$schema" is omitted and therefore defaults to that of the enclosing resource, - MAY be validated by applying the appropriate meta-schema.

    -
    -
    -
    -

    -9.4. Caveats -

    -
    -

    -9.4.1. Guarding Against Infinite Recursion -

    -

    - A schema MUST NOT be run into an infinite loop against an instance. For - example, if two schemas "#alice" and "#bob" both have an "allOf" property - that refers to the other, a naive validator might get stuck in an infinite - recursive loop trying to validate the instance. Schemas SHOULD NOT make - use of infinite recursive nesting like this; the behavior is undefined.

    -
    -
    -
    -

    -9.4.2. References to Possible Non-Schemas -

    -

    - Subschema objects (or booleans) are recognized by their use with known - applicator keywords or with location-reserving keywords such as - "$defs" (Section 8.2.4) that take one or more subschemas - as a value. These keywords may be "$defs" and the standard applicators - from this document, or extension keywords from a known vocabulary, or - implementation-specific custom keywords.

    -

    - Multi-level structures of unknown keywords are capable of introducing - nested subschemas, which would be subject to the processing rules for - "$id". Therefore, having a reference target in such an unrecognized - structure cannot be reliably implemented, and the resulting behavior - is undefined. Similarly, a reference target under a known keyword, - for which the value is known not to be a schema, results in undefined - behavior in order to avoid burdening implementations with the need - to detect such targets. - - These scenarios are analogous to fetching a schema over HTTP - but receiving a response with a Content-Type other than - application/schema+json. An implementation can certainly - try to interpret it as a schema, but the origin server - offered no guarantee that it actually is any such thing. - Therefore, interpreting it as such has security implications - and may produce unpredictable results. -

    -

    - Note that single-level custom keywords with identical syntax and - semantics to "$defs" do not allow for any intervening "$id" keywords, - and therefore will behave correctly under implementations that attempt - to use any reference target as a schema. However, this behavior is - implementation-specific and MUST NOT be relied upon for interoperability.

    -
    -
    -
    -
    -

    -9.5. Associating Instances and Schemas -

    -
    -
    -

    -9.5.1. Usage for Hypermedia -

    -

    - JSON has been adopted widely by HTTP servers for automated APIs and robots. This - section describes how to enhance processing of JSON documents in a more RESTful - manner when used with protocols that support media types and - Web linking [RFC8288].

    -
    -
    -9.5.1.1. Linking to a Schema -
    -

    - It is RECOMMENDED that instances described by a schema provide a link to - a downloadable JSON Schema using the link relation "describedby", as defined by - Linked Data Protocol 1.0, section 8.1 [W3C.REC-ldp-20150226].

    -

    - In HTTP, such links can be attached to any response using the - Link header [RFC8288]. An example of such a header would be:

    -
    -
    -
    -        Link: <https://example.com/my-hyper-schema>; rel="describedby"
    -
    -
    -
    -
    -
    -
    -9.5.1.2. Usage Over HTTP -
    -

    - When used for hypermedia systems over a network, - HTTP [RFC7231] is frequently the protocol of choice for - distributing schemas. Misbehaving clients can pose problems for server - maintainers if they pull a schema over the network more frequently than - necessary, when it's instead possible to cache a schema for a long period of - time.

    -

    - HTTP servers SHOULD set long-lived caching headers on JSON Schemas. - HTTP clients SHOULD observe caching headers and not re-request documents within - their freshness period. - Distributed systems SHOULD make use of a shared cache and/or caching proxy.

    -

    - Clients SHOULD set or prepend a User-Agent header specific to the JSON Schema - implementation or software product. Since symbols are listed in decreasing order - of significance, the JSON Schema library name/version should precede the more - generic HTTP library name (if any). For example:

    -
    -
    -
    -        User-Agent: product-name/5.4.1 so-cool-json-schema/1.0.2 curl/7.43.0
    -
    -
    -
    -

    - Clients SHOULD be able to make requests with a "From" header so that server - operators can contact the owner of a potentially misbehaving script.

    -
    -
    -
    -
    -
    -
    -

    -10. A Vocabulary for Applying Subschemas -

    -

    - This section defines a vocabulary of applicator keywords that - are RECOMMENDED for use as the basis of other vocabularies.

    -

    - Meta-schemas that do not use "$vocabulary" SHOULD be considered to - require this vocabulary as if its URI were present with a value of true.

    -

    - The current URI for this vocabulary, known as the Applicator vocabulary, is: - <https://json-schema.org/draft/2020-12/vocab/applicator>.

    -

    - The current URI for the corresponding meta-schema is: - https://json-schema.org/draft/2020-12/meta/applicator.

    -
    -

    -10.1. Keyword Independence -

    -

    - Schema keywords typically operate independently, without - affecting each other's outcomes.

    -

    - For schema author convenience, there are some exceptions among the - keywords in this vocabulary:

    -
      -
    • - "additionalProperties", whose behavior is defined in terms of - "properties" and "patternProperties" -
    • -
    • - "items", whose behavior is defined in terms of "prefixItems" -
    • -
    • - "contains", whose behavior is affected by the presence and value of - "minContains", in the Validation vocabulary -
    • -
    -
    -
    -
    -

    -10.2. Keywords for Applying Subschemas in Place -

    -

    - These keywords apply subschemas to the same location in the instance - as the parent schema is being applied. They allow combining - or modifying the subschema results in various ways.

    -

    - Subschemas of these keywords evaluate the instance completely independently - such that the results of one such subschema MUST NOT impact the results of sibling - subschemas. Therefore subschemas may be applied in - any order.

    -
    -
    -

    -10.2.1. Keywords for Applying Subschemas With Logic -

    -

    - These keywords correspond to logical operators for combining or modifying - the boolean assertion results of the subschemas. They have no direct - impact on annotation collection, although they enable the same annotation - keyword to be applied to an instance location with different values. - Annotation keywords define their own rules for combining such values.

    -
    -
    -
    -10.2.1.1. allOf -
    -

    - This keyword's value MUST be a non-empty array. - Each item of the array MUST be a valid JSON Schema.

    -

    - An instance validates successfully against this keyword if it validates - successfully against all schemas defined by this keyword's value.

    -
    -
    -
    -
    -10.2.1.2. anyOf -
    -

    - This keyword's value MUST be a non-empty array. - Each item of the array MUST be a valid JSON Schema.

    -

    - An instance validates successfully against this keyword if it validates - successfully against at least one schema defined by this keyword's value. - Note that when annotations are being collected, all subschemas MUST - be examined so that annotations are collected from each subschema - that validates successfully.

    -
    -
    -
    -10.2.1.3. oneOf -
    -

    - This keyword's value MUST be a non-empty array. - Each item of the array MUST be a valid JSON Schema.

    -

    - An instance validates successfully against this keyword if it validates - successfully against exactly one schema defined by this keyword's value.

    -
    -
    -
    -
    -10.2.1.4. not -
    -

    - This keyword's value MUST be a valid JSON Schema.

    -

    - An instance is valid against this keyword if it fails to validate - successfully against the schema defined by this keyword.

    -
    -
    -
    -
    -
    -
    -

    -10.2.2. Keywords for Applying Subschemas Conditionally -

    -

    - Three of these keywords work together to implement conditional - application of a subschema based on the outcome of another subschema. - The fourth is a shortcut for a specific conditional case.

    -

    - "if", "then", and "else" MUST NOT interact with each other across - subschema boundaries. In other words, an "if" in one - branch of an "allOf" MUST NOT have an impact on a "then" - or "else" in another branch.

    -

    - There is no default behavior for "if", "then", or "else" - when they are not present. In particular, they MUST NOT - be treated as if present with an empty schema, and when - "if" is not present, both "then" and "else" MUST be - entirely ignored.

    -
    -
    -10.2.2.1. if -
    -

    - This keyword's value MUST be a valid JSON Schema.

    -

    - This validation outcome of this keyword's subschema - has no direct effect on the overall validation - result. Rather, it controls which of the "then" - or "else" keywords are evaluated.

    -

    - Instances that successfully validate against this - keyword's subschema MUST also be valid against - the subschema value of the "then" keyword, if - present.

    -

    - Instances that fail to validate against this - keyword's subschema MUST also be valid against - the subschema value of the "else" keyword, if - present.

    -

    - If annotations (Section 7.7) - are being collected, they are collected from this - keyword's subschema in the usual way, including when - the keyword is present without either "then" or "else".

    -
    -
    -
    -10.2.2.2. then -
    -

    - This keyword's value MUST be a valid JSON Schema.

    -

    - When "if" is present, and the instance successfully - validates against its subschema, then validation - succeeds against this keyword if the instance also - successfully validates against this keyword's subschema.

    -

    - This keyword has no effect when "if" is absent, or - when the instance fails to validate against its - subschema. Implementations MUST NOT evaluate - the instance against this keyword, for either validation - or annotation collection purposes, in such cases.

    -
    -
    -
    -10.2.2.3. else -
    -

    - This keyword's value MUST be a valid JSON Schema.

    -

    - When "if" is present, and the instance fails to - validate against its subschema, then validation - succeeds against this keyword if the instance - successfully validates against this keyword's subschema.

    -

    - This keyword has no effect when "if" is absent, or - when the instance successfully validates against its - subschema. Implementations MUST NOT evaluate - the instance against this keyword, for either validation - or annotation collection purposes, in such cases.

    -
    -
    -
    -10.2.2.4. dependentSchemas -
    -

    - This keyword specifies subschemas that are evaluated if the instance - is an object and contains a certain property.

    -

    - This keyword's value MUST be an object. - Each value in the object MUST be a valid JSON Schema.

    -

    - If the object key is a property in the instance, the entire - instance must validate against the subschema. Its use is - dependent on the presence of the property.

    -

    - Omitting this keyword has the same behavior as an empty object.

    -
    -
    -
    -
    -
    -
    -

    -10.3. Keywords for Applying Subschemas to Child Instances -

    -

    - Each of these keywords defines a rule for applying its - subschema(s) to child instances, specifically object - properties and array items, and combining their results.

    -
    -

    -10.3.1. Keywords for Applying Subschemas to Arrays -

    -
    -
    -10.3.1.1. prefixItems -
    -

    - The value of "prefixItems" MUST be a non-empty array of valid JSON Schemas.

    -

    - Validation succeeds if each element of the instance validates - against the schema at the same position, if any. This keyword - does not constrain the length of the array. If the array is longer - than this keyword's value, this keyword validates only the - prefix of matching length.

    -

    - This keyword produces an annotation value which is the largest - index to which this keyword applied a subschema. The value - MAY be a boolean true if a subschema was applied to every - index of the instance, such as is produced by the "items" keyword. - This annotation affects the behavior of "items" and "unevaluatedItems".

    -

    - Omitting this keyword has the same assertion behavior as - an empty array.

    -
    -
    -
    -
    -10.3.1.2. items -
    -

    - The value of "items" MUST be a valid JSON Schema.

    -

    - This keyword applies its subschema to all instance elements - at indexes greater than the length of the "prefixItems" array - in the same schema object, as reported by the annotation result - of that "prefixItems" keyword. If no such annotation - result exists, "items" applies its subschema to all instance - array elements. - - Note that the behavior of "items" without "prefixItems" is - identical to that of the schema form of "items" in prior drafts. - When "prefixItems" is present, the behavior of "items" is - identical to the former "additionalItems" keyword. -

    -

    - If the "items" subschema is applied to any - positions within the instance array, it produces an - annotation result of boolean true, indicating that all remaining array - elements have been evaluated against this keyword's subschema. - This annotation affects the behavior of "unevaluatedItems" in the - Unevaluated vocabulary.

    -

    - Omitting this keyword has the same assertion behavior as - an empty schema.

    -

    - Implementations MAY choose to implement or optimize this keyword - in another way that produces the same effect, such as by directly - checking for the presence and size of a "prefixItems" array. - Implementations that do not support annotation collection MUST do so.

    -
    -
    -
    -
    -10.3.1.3. contains -
    -

    - The value of this keyword MUST be a valid JSON Schema.

    -

    - An array instance is valid against "contains" if at least one of - its elements is valid against the given schema, - except when "minContains" is present and has a value of 0, in which - case an array instance MUST be considered valid against the "contains" keyword, - even if none of its elements is valid against the given schema.

    -

    - This keyword produces an annotation value which is an array of - the indexes to which this keyword validates successfully when applying - its subschema, in ascending order. The value MAY be a boolean "true" if - the subschema validates successfully when applied to every index of the - instance. The annotation MUST be present if the instance array to which - this keyword's schema applies is empty.

    -

    - This annotation affects the behavior of "unevaluatedItems" in the - Unevaluated vocabulary, and MAY also be used to implement the - "minContains" and "maxContains" keywords in the Validation vocabulary.

    -

    - The subschema MUST be applied to every array element even after the first - match has been found, in order to collect annotations for use by other - keywords. This is to ensure that all possible annotations are collected.

    -
    -
    -
    -

    -10.3.2. Keywords for Applying Subschemas to Objects -

    -
    -
    -10.3.2.1. properties -
    -

    - The value of "properties" MUST be an object. - Each value of this object MUST be a valid JSON Schema.

    -

    - Validation succeeds if, for each name that appears in both - the instance and as a name within this keyword's value, the child - instance for that name successfully validates against the - corresponding schema.

    -

    - The annotation result of this keyword is the set of instance - property names matched by this keyword. - This annotation affects the behavior of "additionalProperties" (in - this vocabulary) and "unevaluatedProperties" in the Unevaluated vocabulary.

    -

    - Omitting this keyword has the same assertion behavior as - an empty object.

    -
    -
    -
    -10.3.2.2. patternProperties -
    -

    - The value of "patternProperties" MUST be an object. Each property name - of this object SHOULD be a valid regular expression, according to the - ECMA-262 regular expression dialect. Each property value of this object - MUST be a valid JSON Schema.

    -

    - Validation succeeds if, for each instance name that matches any - regular expressions that appear as a property name in this keyword's value, - the child instance for that name successfully validates against each - schema that corresponds to a matching regular expression.

    -

    - The annotation result of this keyword is the set of instance - property names matched by this keyword. - This annotation affects the behavior of "additionalProperties" (in this - vocabulary) and "unevaluatedProperties" (in the Unevaluated vocabulary).

    -

    - Omitting this keyword has the same assertion behavior as - an empty object.

    -
    -
    -
    -
    -10.3.2.3. additionalProperties -
    -

    - The value of "additionalProperties" MUST be a valid JSON Schema.

    -

    - The behavior of this keyword depends on the presence and - annotation results of "properties" and "patternProperties" - within the same schema object. - Validation with "additionalProperties" applies only to the child - values of instance names that do not appear in the annotation - results of either "properties" or "patternProperties".

    -

    - For all such properties, validation succeeds if the child instance - validates against the "additionalProperties" schema.

    -

    - The annotation result of this keyword is the set of instance - property names validated by this keyword's subschema. - This annotation affects the behavior of "unevaluatedProperties" - in the Unevaluated vocabulary.

    -

    - Omitting this keyword has the same assertion behavior as - an empty schema.

    -

    - Implementations MAY choose to implement or optimize this keyword - in another way that produces the same effect, such as by directly - checking the names in "properties" and the patterns in - "patternProperties" against the instance property set. - Implementations that do not support annotation collection MUST do so. - - In defining this option, it seems there is the potential for - ambiguity in the output format. The ambiguity does not affect validation results, - but it does affect the resulting output format. - The ambiguity allows for multiple valid output results depending on whether annotations - are used or a solution that "produces the same effect" as draft-07. It is understood - that annotations from failing schemas are dropped. - See our - [Decision Record](https://github.com/json-schema-org/json-schema-spec/tree/HEAD/adr/2022-04-08-cref-for-ambiguity-and-fix-later-gh-spec-issue-1172.md) - for further details. -

    -
    -
    -
    -
    -10.3.2.4. propertyNames -
    -

    - The value of "propertyNames" MUST be a valid JSON Schema.

    -

    - If the instance is an object, this keyword validates if every property name in - the instance validates against the provided schema. - Note the property name that the schema is testing will always be a string.

    -

    - Omitting this keyword has the same behavior as an empty schema.

    -
    -
    -
    -
    -
    -

    -11. A Vocabulary for Unevaluated Locations -

    -

    - The purpose of these keywords is to enable schema authors to apply - subschemas to array items or object properties that have not been - successfully evaluated against any dynamic-scope subschema of any - adjacent keywords.

    -

    - These instance items or properties may have been unsuccessfully evaluated - against one or more adjacent keyword subschemas, such as when an assertion - in a branch of an "anyOf" fails. Such failed evaluations are not considered - to contribute to whether or not the item or property has been evaluated. - Only successful evaluations are considered.

    -

    - If an item in an array or an object property is "successfully evaluated", it - is logically considered to be valid in terms of the representation of the - object or array that's expected. For example if a subschema represents a car, - which requires between 2-4 wheels, and the value of "wheels" is 6, the instance - object is not "evaluated" to be a car, and the "wheels" property is considered - "unevaluated (successfully as a known thing)", and does not retain any annotations.

    -

    - Recall that adjacent keywords are keywords within the same schema object, - and that the dynamic-scope subschemas include reference targets as well as - lexical subschemas.

    -

    - The behavior of these keywords depend on the annotation results of - adjacent keywords that apply to the instance location being validated.

    -

    - Meta-schemas that do not use "$vocabulary" SHOULD be considered to - require this vocabulary as if its URI were present with a value of true.

    -

    - The current URI for this vocabulary, known as the Unevaluated Applicator - vocabulary, is: - <https://json-schema.org/draft/2020-12/vocab/unevaluated>.

    -

    - The current URI for the corresponding meta-schema is: - https://json-schema.org/draft/2020-12/meta/unevaluated.

    -
    -

    -11.1. Keyword Independence -

    -

    - Schema keywords typically operate independently, without - affecting each other's outcomes. However, the keywords in this - vocabulary are notable exceptions:

    -
      -
    • - "unevaluatedItems", whose behavior is defined in terms of annotations - from "prefixItems", "items", "contains", and itself -
    • -
    • - "unevaluatedProperties", whose behavior is defined in terms of - annotations from "properties", "patternProperties", - "additionalProperties" and itself -
    • -
    -
    -
    -
    -

    -11.2. unevaluatedItems -

    -

    - The value of "unevaluatedItems" MUST be a valid JSON Schema.

    -

    - The behavior of this keyword depends on the annotation results of - adjacent keywords that apply to the instance location being validated. - Specifically, the annotations from "prefixItems", "items", and "contains", - which can come from those keywords when they are adjacent to the - "unevaluatedItems" keyword. Those three annotations, as well as - "unevaluatedItems", can also result from any and all adjacent - in-place applicator (Section 10.2) keywords. - This includes but is not limited to the in-place applicators - defined in this document.

    -

    - If no relevant annotations are present, the "unevaluatedItems" - subschema MUST be applied to all locations in the array. - If a boolean true value is present from any of the relevant annotations, - "unevaluatedItems" MUST be ignored. Otherwise, the subschema - MUST be applied to any index greater than the largest annotation - value for "prefixItems", which does not appear in any annotation - value for "contains".

    -

    - This means that "prefixItems", "items", "contains", and all in-place - applicators MUST be evaluated before this keyword can be evaluated. - Authors of extension keywords MUST NOT define an in-place applicator - that would need to be evaluated after this keyword.

    -

    - If the "unevaluatedItems" subschema is applied to any - positions within the instance array, it produces an - annotation result of boolean true, analogous to the - behavior of "items". - This annotation affects the behavior of "unevaluatedItems" in parent schemas.

    -

    - Omitting this keyword has the same assertion behavior as - an empty schema.

    -
    -
    -
    -
    -

    -11.3. unevaluatedProperties -

    -

    - The value of "unevaluatedProperties" MUST be a valid JSON Schema.

    -

    - The behavior of this keyword depends on the annotation results of - adjacent keywords that apply to the instance location being validated. - Specifically, the annotations from "properties", "patternProperties", - and "additionalProperties", which can come from those keywords when - they are adjacent to the "unevaluatedProperties" keyword. Those - three annotations, as well as "unevaluatedProperties", can also - result from any and all adjacent - in-place applicator (Section 10.2) keywords. - This includes but is not limited to the in-place applicators - defined in this document.

    -

    - Validation with "unevaluatedProperties" applies only to the child - values of instance names that do not appear in the "properties", - "patternProperties", "additionalProperties", or - "unevaluatedProperties" annotation results that apply to the - instance location being validated.

    -

    - For all such properties, validation succeeds if the child instance - validates against the "unevaluatedProperties" schema.

    -

    - This means that "properties", "patternProperties", "additionalProperties", - and all in-place applicators MUST be evaluated before this keyword can - be evaluated. Authors of extension keywords MUST NOT define an in-place - applicator that would need to be evaluated after this keyword.

    -

    - The annotation result of this keyword is the set of instance - property names validated by this keyword's subschema. - This annotation affects the behavior of "unevaluatedProperties" in parent schemas.

    -

    - Omitting this keyword has the same assertion behavior as - an empty schema.

    -
    -
    -
    -
    -
    -

    -12. Output Formatting -

    -

    - JSON Schema is defined to be platform-independent. As such, to increase compatibility - across platforms, implementations SHOULD conform to a standard validation output - format. This section describes the minimum requirements that consumers will need to - properly interpret validation results.

    -
    -

    -12.1. Format -

    -

    - JSON Schema output is defined using the JSON Schema data instance model as described - in section 4.2.1. Implementations MAY deviate from this as supported by their - specific languages and platforms, however it is RECOMMENDED that the output be - convertible to the JSON format defined herein via serialization or other means.

    -
    -
    -

    -12.2. Output Formats -

    -

    - This specification defines four output formats. See the "Output Structure" - section for the requirements of each format.

    -
      -
    • - Flag - A boolean which simply indicates the overall validation result - with no further details. -
    • -
    • - Basic - Provides validation information in a flat list structure. -
    • -
    • - Detailed - Provides validation information in a condensed hierarchical - structure based on the structure of the schema. -
    • -
    • - Verbose - Provides validation information in an uncondensed hierarchical - structure that matches the exact structure of the schema. -
    • -
    -

    - An implementation SHOULD provide at least one of the "flag", "basic", or "detailed" - format and MAY provide the "verbose" format. If it provides one or more of the - "detailed" or "verbose" formats, it MUST also provide the "flag" format. - Implementations SHOULD specify in their documentation which formats they support.

    -
    -
    -

    -12.3. Minimum Information -

    -

    - Beyond the simplistic "flag" output, additional information is useful to aid in - debugging a schema or instance. Each sub-result SHOULD contain the information - contained within this section at a minimum.

    -

    - A single object that contains all of these components is considered an - output unit.

    -

    - Implementations MAY elect to provide additional information.

    -
    -

    -12.3.1. Keyword Relative Location -

    -

    - The relative location of the validating keyword that follows the validation - path. The value MUST be expressed as a JSON Pointer, and it MUST include - any by-reference applicators such as "$ref" or "$dynamicRef".

    -
    -
    -
    -/properties/width/$ref/minimum
    -
    -
    -
    -

    - Note that this pointer may not be resolvable by the normal JSON Pointer process - due to the inclusion of these by-reference applicator keywords.

    -

    - The JSON key for this information is "keywordLocation".

    -
    -
    -

    -12.3.2. Keyword Absolute Location -

    -

    - The absolute, dereferenced location of the validating keyword. The value MUST - be expressed as a full URI using the canonical URI of the relevant schema resource - with a JSON Pointer fragment, and it MUST NOT include by-reference applicators - such as "$ref" or "$dynamicRef" as non-terminal path components. - It MAY end in such keywords if the error or annotation is for that - keyword, such as an unresolvable reference. - - Note that "absolute" here is in the sense of "absolute filesystem path" - (meaning the complete location) rather than the "absolute-URI" - terminology from RFC 3986 (meaning with scheme but without fragment). - Keyword absolute locations will have a fragment in order to - identify the keyword. -

    -
    -
    -
    -https://example.com/schemas/common#/$defs/count/minimum
    -
    -
    -
    -

    - This information MAY be omitted only if either the dynamic scope did not pass - over a reference or if the schema does not declare an absolute URI as its "$id".

    -

    - The JSON key for this information is "absoluteKeywordLocation".

    -
    -
    -

    -12.3.3. Instance Location -

    -

    - The location of the JSON value within the instance being validated. The - value MUST be expressed as a JSON Pointer.

    -

    - The JSON key for this information is "instanceLocation".

    -
    -
    -

    -12.3.4. Error or Annotation -

    -

    - The error or annotation that is produced by the validation.

    -

    - For errors, the specific wording for the message is not defined by this - specification. Implementations will need to provide this.

    -

    - For annotations, each keyword that produces an annotation specifies its - format. By default, it is the keyword's value.

    -

    - The JSON key for failed validations is "error"; for successful validations - it is "annotation".

    -
    -
    -

    -12.3.5. Nested Results -

    -

    - For the two hierarchical structures, this property will hold nested errors - and annotations.

    -

    - The JSON key for nested results in failed validations is "errors"; for - successful validations it is "annotations". Note the plural forms, as - a keyword with nested results can also have a local error or annotation.

    -
    -
    -
    -

    -12.4. Output Structure -

    -

    - The output MUST be an object containing a boolean property named "valid". When - additional information about the result is required, the output MUST also contain - "errors" or "annotations" as described below.

    -
      -
    • - "valid" - a boolean value indicating the overall validation success or - failure -
    • -
    • - "errors" - the collection of errors or annotations produced by a failed - validation -
    • -
    • - "annotations" - the collection of errors or annotations produced by a - successful validation -
    • -
    -

    - For these examples, the following schema and instance will be used.

    -
    -
    -
    -{
    -  "$id": "https://example.com/polygon",
    -  "$schema": "https://json-schema.org/draft/2020-12/schema",
    -  "$defs": {
    -    "point": {
    -      "type": "object",
    -      "properties": {
    -        "x": { "type": "number" },
    -        "y": { "type": "number" }
    -      },
    -      "additionalProperties": false,
    -      "required": [ "x", "y" ]
    -    }
    -  },
    -  "type": "array",
    -  "items": { "$ref": "#/$defs/point" },
    -  "minItems": 3
    -}
    -
    -[
    -  {
    -    "x": 2.5,
    -    "y": 1.3
    -  },
    -  {
    -    "x": 1,
    -    "z": 6.7
    -  }
    -]
    -
    -
    -
    -

    - This instance will fail validation and produce errors, but it's trivial to deduce - examples for passing schemas that produce annotations.

    -

    - Specifically, the errors it will produce are:

    -
      -
    • - The second object is missing a "y" property. -
    • -
    • - The second object has a disallowed "z" property. -
    • -
    • - There are only two objects, but three are required. -
    • -
    -

    - Note that the error message wording as depicted in these examples is not a - requirement of this specification. Implementations SHOULD craft error messages - tailored for their audience or provide a templating mechanism that allows their - users to craft their own messages.

    -
    -

    -12.4.1. Flag -

    -

    - In the simplest case, merely the boolean result for the "valid" valid property - needs to be fulfilled.

    -
    -
    -
    -{
    -  "valid": false
    -}
    -
    -
    -
    -

    - Because no errors or annotations are returned with this format, it is - RECOMMENDED that implementations use short-circuiting logic to return - failure or success as soon as the outcome can be determined. For example, - if an "anyOf" keyword contains five sub-schemas, and the second one - passes, there is no need to check the other three. The logic can simply - return with success.

    -
    -
    -

    -12.4.2. Basic -

    -

    - The "Basic" structure is a flat list of output units.

    -
    -
    -
    -{
    -  "valid": false,
    -  "errors": [
    -    {
    -      "keywordLocation": "",
    -      "instanceLocation": "",
    -      "error": "A subschema had errors."
    -    },
    -    {
    -      "keywordLocation": "/items/$ref",
    -      "absoluteKeywordLocation":
    -        "https://example.com/polygon#/$defs/point",
    -      "instanceLocation": "/1",
    -      "error": "A subschema had errors."
    -    },
    -    {
    -      "keywordLocation": "/items/$ref/required",
    -      "absoluteKeywordLocation":
    -        "https://example.com/polygon#/$defs/point/required",
    -      "instanceLocation": "/1",
    -      "error": "Required property 'y' not found."
    -    },
    -    {
    -      "keywordLocation": "/items/$ref/additionalProperties",
    -      "absoluteKeywordLocation":
    -        "https://example.com/polygon#/$defs/point/additionalProperties",
    -      "instanceLocation": "/1/z",
    -      "error": "Additional property 'z' found but was invalid."
    -    },
    -    {
    -      "keywordLocation": "/minItems",
    -      "instanceLocation": "",
    -      "error": "Expected at least 3 items but found 2"
    -    }
    -  ]
    -}
    -
    -
    -
    -
    -
    -

    -12.4.3. Detailed -

    -

    - The "Detailed" structure is based on the schema and can be more readable - for both humans and machines. Having the structure organized this way makes - associations between the errors more apparent. For example, the fact that - the missing "y" property and the extra "z" property both stem from the same - location in the instance is not immediately obvious in the "Basic" structure. - In a hierarchy, the correlation is more easily identified.

    -

    - The following rules govern the construction of the results object:

    -
      -
    • - All applicator keywords ("*Of", "$ref", "if"/"then"/"else", etc.) require - a node. -
    • -
    • - Nodes that have no children are removed. -
    • -
    • - Nodes that have a single child are replaced by the child. -
    • -
    -

    - Branch nodes do not require an error message or an annotation.

    -
    -
    -
    -{
    -  "valid": false,
    -  "keywordLocation": "",
    -  "instanceLocation": "",
    -  "errors": [
    -    {
    -      "valid": false,
    -      "keywordLocation": "/items/$ref",
    -      "absoluteKeywordLocation":
    -        "https://example.com/polygon#/$defs/point",
    -      "instanceLocation": "/1",
    -      "errors": [
    -        {
    -          "valid": false,
    -          "keywordLocation": "/items/$ref/required",
    -          "absoluteKeywordLocation":
    -            "https://example.com/polygon#/$defs/point/required",
    -          "instanceLocation": "/1",
    -          "error": "Required property 'y' not found."
    -        },
    -        {
    -          "valid": false,
    -          "keywordLocation": "/items/$ref/additionalProperties",
    -          "absoluteKeywordLocation":
    -            "https://example.com/polygon#/$defs/point/additionalProperties",
    -          "instanceLocation": "/1/z",
    -          "error": "Additional property 'z' found but was invalid."
    -        }
    -      ]
    -    },
    -    {
    -      "valid": false,
    -      "keywordLocation": "/minItems",
    -      "instanceLocation": "",
    -      "error": "Expected at least 3 items but found 2"
    -    }
    -  ]
    -}
    -
    -
    -
    -
    -
    -

    -12.4.4. Verbose -

    -

    - The "Verbose" structure is a fully realized hierarchy that exactly matches - that of the schema. This structure has applications in form generation and - validation where the error's location is important.

    -

    - The primary difference between this and the "Detailed" structure is that - all results are returned. This includes sub-schema validation results that - would otherwise be removed (e.g. annotations for failed validations, - successful validations inside a `not` keyword, etc.). Because of this, it - is RECOMMENDED that each node also carry a `valid` property to indicate the - validation result for that node.

    -

    - Because this output structure can be quite large, a smaller example is given - here for brevity. The URI of the full output structure of the example above is: - https://json-schema.org/draft/2020-12/output/verbose-example.

    -
    -
    -
    -// schema
    -{
    -  "$id": "https://example.com/polygon",
    -  "$schema": "https://json-schema.org/draft/2020-12/schema",
    -  "type": "object",
    -  "properties": {
    -    "validProp": true,
    -  },
    -  "additionalProperties": false
    -}
    -
    -// instance
    -{
    -  "validProp": 5,
    -  "disallowedProp": "value"
    -}
    -
    -// result
    -{
    -  "valid": false,
    -  "keywordLocation": "",
    -  "instanceLocation": "",
    -  "errors": [
    -    {
    -      "valid": true,
    -      "keywordLocation": "/type",
    -      "instanceLocation": ""
    -    },
    -    {
    -      "valid": true,
    -      "keywordLocation": "/properties",
    -      "instanceLocation": ""
    -    },
    -    {
    -      "valid": false,
    -      "keywordLocation": "/additionalProperties",
    -      "instanceLocation": "",
    -      "errors": [
    -        {
    -          "valid": false,
    -          "keywordLocation": "/additionalProperties",
    -          "instanceLocation": "/disallowedProp",
    -          "error": "Additional property 'disallowedProp' found but was invalid."
    -        }
    -      ]
    -    }
    -  ]
    -}
    -
    -
    -
    -
    -
    -

    -12.4.5. Output validation schemas -

    -

    - For convenience, JSON Schema has been provided to validate output generated - by implementations. Its URI is: - https://json-schema.org/draft/2020-12/output/schema.

    -
    -
    -
    -
    -
    -
    -

    -13. Security Considerations -

    -

    - Both schemas and instances are JSON values. As such, all security considerations - defined in RFC 8259 [RFC8259] apply.

    -

    - Instances and schemas are both frequently written by untrusted third parties, to be - deployed on public Internet servers. - Validators should take care that the parsing and validating against schemas does not consume excessive - system resources. - Validators MUST NOT fall into an infinite loop.

    -

    - A malicious party could cause an implementation to repeatedly collect a copy - of a very large value as an annotation. Implementations SHOULD guard against - excessive consumption of system resources in such a scenario.

    -

    - Servers MUST ensure that malicious parties cannot change the functionality of - existing schemas by uploading a schema with a pre-existing or very similar "$id".

    -

    - Individual JSON Schema vocabularies are liable to also have their own security - considerations. Consult the respective specifications for more information.

    -

    - Schema authors should take care with "$comment" contents, as a malicious - implementation can display them to end-users in violation of a spec, or - fail to strip them if such behavior is expected.

    -

    - A malicious schema author could place executable code or other dangerous - material within a "$comment". Implementations MUST NOT parse or otherwise - take action based on "$comment" contents.

    -
    -
    -
    -

    -14. IANA Considerations -

    -
    -

    -14.1. application/schema+json -

    -

    - The proposed MIME media type for JSON Schema is defined as follows:

    -
      -
    • Type name: application -
    • -
    • Subtype name: schema+json -
    • -
    • Required parameters: N/A -
    • -
    • - Encoding considerations: Encoding considerations are - identical to those specified for the "application/json" - media type. See JSON [RFC8259]. -
    • -
    • - Security considerations: See Section - 13 above. -
    • -
    • - Interoperability considerations: See Sections - 6.2, - 6.3, and - 6.4 above. -
    • -
    • - Fragment identifier considerations: See Section - 5 -
    • -
    -
    -
    -

    -14.2. application/schema-instance+json -

    -

    - The proposed MIME media type for JSON Schema Instances that require - a JSON Schema-specific media type is defined as follows:

    -
      -
    • Type name: application -
    • -
    • Subtype name: schema-instance+json -
    • -
    • Required parameters: N/A -
    • -
    • - Encoding considerations: Encoding considerations are - identical to those specified for the "application/json" - media type. See JSON [RFC8259]. -
    • -
    • - Security considerations: See Section - 13 above. -
    • -
    • - Interoperability considerations: See Sections - 6.2, - 6.3, and - 6.4 above. -
    • -
    • - Fragment identifier considerations: See Section - 5 -
    • -
    -
    -
    -
    -

    -15. References -

    -
    -

    -15.1. Normative References -

    -
    -
    [RFC2119]
    -
    -Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/info/rfc2119>.
    -
    -
    [RFC3986]
    -
    -Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, DOI 10.17487/RFC3986, , <https://www.rfc-editor.org/info/rfc3986>.
    -
    -
    [RFC6839]
    -
    -Hansen, T. and A. Melnikov, "Additional Media Type Structured Syntax Suffixes", RFC 6839, DOI 10.17487/RFC6839, , <https://www.rfc-editor.org/info/rfc6839>.
    -
    -
    [RFC6901]
    -
    -Bryan, P., Ed., Zyp, K., and M. Nottingham, Ed., "JavaScript Object Notation (JSON) Pointer", RFC 6901, DOI 10.17487/RFC6901, , <https://www.rfc-editor.org/info/rfc6901>.
    -
    -
    [RFC8259]
    -
    -Bray, T., Ed., "The JavaScript Object Notation (JSON) Data Interchange Format", STD 90, RFC 8259, DOI 10.17487/RFC8259, , <https://www.rfc-editor.org/info/rfc8259>.
    -
    -
    [W3C.REC-ldp-20150226]
    -
    -Speicher, S., Arwe, J., and A. Malhotra, "Linked Data Platform 1.0", World Wide Web Consortium Recommendation REC-ldp-20150226, , <https://www.w3.org/TR/2015/REC-ldp-20150226>.
    -
    -
    [ecma262]
    -
    -"ECMA-262, 11th edition specification", , <https://www.ecma-international.org/ecma-262/11.0/index.html>.
    -
    -
    -
    -
    -

    -15.2. Informative References -

    -
    -
    [RFC6596]
    -
    -Ohye, M. and J. Kupke, "The Canonical Link Relation", RFC 6596, DOI 10.17487/RFC6596, , <https://www.rfc-editor.org/info/rfc6596>.
    -
    -
    [RFC7049]
    -
    -Bormann, C. and P. Hoffman, "Concise Binary Object Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, , <https://www.rfc-editor.org/info/rfc7049>.
    -
    -
    [RFC7231]
    -
    -Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content", RFC 7231, DOI 10.17487/RFC7231, , <https://www.rfc-editor.org/info/rfc7231>.
    -
    -
    [RFC8288]
    -
    -Nottingham, M., "Web Linking", RFC 8288, DOI 10.17487/RFC8288, , <https://www.rfc-editor.org/info/rfc8288>.
    -
    -
    [W3C.WD-fragid-best-practices-20121025]
    -
    -Tennison, J., "Best Practices for Fragment Identifiers and Media Type Definitions", World Wide Web Consortium WD WD-fragid-best-practices-20121025, , <https://www.w3.org/TR/2012/WD-fragid-best-practices-20121025>.
    -
    -
    [json-schema-validation]
    -
    -Wright, A., Andrews, H., and B. Hutton, "JSON Schema Validation: A Vocabulary for Structural Validation of JSON", Work in Progress, Internet-Draft, draft-bhutton-json-schema-validation-01, , <https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-01>.
    -
    -
    [json-hyper-schema]
    -
    -Andrews, H. and A. Wright, "JSON Hyper-Schema: A Vocabulary for Hypermedia Annotation of JSON", Work in Progress, Internet-Draft, draft-handrews-json-schema-hyperschema-02, , <https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-hyperschema-02>.
    -
    -
    [xml-names]
    -
    -Bray, T., Ed., Hollander, D., Ed., Layman, A., Ed., and R. Tobin, Ed., "Namespaces in XML 1.1 (Second Edition)", , <http://www.w3.org/TR/2006/REC-xml-names11-20060816>.
    -
    -
    -
    -
    -
    -
    -

    -Appendix A. Schema identification examples -

    -

    - Consider the following schema, which shows "$id" being used to identify - both the root schema and various subschemas, and "$anchor" being used - to define plain name fragment identifiers.

    -
    -
    -
    -{
    -    "$id": "https://example.com/root.json",
    -    "$defs": {
    -        "A": { "$anchor": "foo" },
    -        "B": {
    -            "$id": "other.json",
    -            "$defs": {
    -                "X": { "$anchor": "bar" },
    -                "Y": {
    -                    "$id": "t/inner.json",
    -                    "$anchor": "bar"
    -                }
    -            }
    -        },
    -        "C": {
    -            "$id": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f"
    -        }
    -    }
    -}
    -
    -
    -
    -

    - The schemas at the following URI-encoded JSON - Pointers [RFC6901] (relative to the root schema) have the following - base URIs, and are identifiable by any listed URI in accordance with - sections 5 and - 9.2.1 above.

    -
    -
    # (document root)
    -
    -
    -
    canonical (and base) URI
    -
    - https://example.com/root.json -
    -
    -
    canonical resource URI plus pointer fragment
    -
    - https://example.com/root.json# -
    -
    -
    -
    -
    -
    #/$defs/A
    -
    -
    -
    base URI
    -
    https://example.com/root.json -
    -
    -
    canonical resource URI plus plain fragment
    -
    - https://example.com/root.json#foo -
    -
    -
    canonical resource URI plus pointer fragment
    -
    - https://example.com/root.json#/$defs/A -
    -
    -
    -
    -
    -
    #/$defs/B
    -
    -
    -
    canonical (and base) URI
    -
    https://example.com/other.json -
    -
    -
    canonical resource URI plus pointer fragment
    -
    - https://example.com/other.json# -
    -
    -
    base URI of enclosing (root.json) resource plus fragment
    -
    - https://example.com/root.json#/$defs/B -
    -
    -
    -
    -
    -
    #/$defs/B/$defs/X
    -
    -
    -
    base URI
    -
    https://example.com/other.json -
    -
    -
    canonical resource URI plus plain fragment
    -
    - https://example.com/other.json#bar -
    -
    -
    canonical resource URI plus pointer fragment
    -
    - https://example.com/other.json#/$defs/X -
    -
    -
    base URI of enclosing (root.json) resource plus fragment
    -
    - https://example.com/root.json#/$defs/B/$defs/X -
    -
    -
    -
    -
    -
    #/$defs/B/$defs/Y
    -
    -
    -
    canonical (and base) URI
    -
    https://example.com/t/inner.json -
    -
    -
    canonical URI plus plain fragment
    -
    - https://example.com/t/inner.json#bar -
    -
    -
    canonical URI plus pointer fragment
    -
    - https://example.com/t/inner.json# -
    -
    -
    base URI of enclosing (other.json) resource plus fragment
    -
    - https://example.com/other.json#/$defs/Y -
    -
    -
    base URI of enclosing (root.json) resource plus fragment
    -
    - https://example.com/root.json#/$defs/B/$defs/Y -
    -
    -
    -
    -
    -
    #/$defs/C
    -
    -
    -
    canonical (and base) URI
    -
    - urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f -
    -
    -
    canonical URI plus pointer fragment
    -
    - urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f# -
    -
    -
    base URI of enclosing (root.json) resource plus fragment
    -
    - https://example.com/root.json#/$defs/C -
    -
    -
    -
    -
    -
    -

    - Note: The fragment part of the URI does not make it canonical or non-canonical, - rather, the base URI used (as part of the full URI with any fragment) is what - determines the canonical nature of the resulting full URI. - - Multiple "canonical" URIs? We Acknowledge this is potentially confusing, and - direct you to read the CREF located in the - JSON Pointer fragments and embedded schema resources (Section 9.2.1) - section for futher comments. -

    -
    -
    -
    -

    -Appendix B. Manipulating schema documents and references -

    -

    - Various tools have been created to rearrange schema documents - based on how and where references ("$ref") appear. This appendix discusses - which use cases and actions are compliant with this specification.

    -
    -

    -B.1. Bundling schema resources into a single document -

    -

    - A set of schema resources intended for use together can be organized - with each in its own schema document, all in the same schema document, - or any granularity of document grouping in between.

    -

    - Numerous tools exist to perform various sorts of reference removal. - A common case of this is producing a single file where all references - can be resolved within that file. This is typically done to simplify - distribution, or to simplify coding so that various invocations - of JSON Schema libraries do not have to keep track of and load - a large number of resources.

    -

    - This transformation can be safely and reversibly done as long as - all static references (e.g. "$ref") use URI-references that resolve - to URIs using the canonical resource URI as the base, and all schema - resources have an absolute-URI as the "$id" in their root schema.

    -

    - With these conditions met, each external resource can be copied - under "$defs", without breaking any references among the resources' - schema objects, and without changing any aspect of validation or - annotation results. The names of the schemas under "$defs" do - not affect behavior, assuming they are each unique, as they - do not appear in the canonical URIs for the embedded resources.

    -
    -
    -

    -B.2. Reference removal is not always safe -

    -

    - Attempting to remove all references and produce a single schema document does not, - in all cases, produce a schema with identical behavior to the original form.

    -

    - Since "$ref" is now treated like any other keyword, with other keywords allowed - in the same schema objects, fully supporting non-recursive "$ref" removal in - all cases can require relatively complex schema manipulations. It is beyond - the scope of this specification to determine or provide a set of safe "$ref" - removal transformations, as they depend not only on the schema structure - but also on the intended usage.

    -
    -
    -
    -
    -

    -Appendix C. Example of recursive schema extension -

    -

    - Consider the following two schemas describing a simple - recursive tree structure, where each node in the tree - can have a "data" field of any type. The first schema - allows and ignores other instance properties. The second is - more strict and only allows the "data" and "children" properties. - An example instance with "data" misspelled as "daat" is also shown.

    -
    -
    -
    -// tree schema, extensible
    -{
    -    "$schema": "https://json-schema.org/draft/2020-12/schema",
    -    "$id": "https://example.com/tree",
    -    "$dynamicAnchor": "node",
    -
    -    "type": "object",
    -    "properties": {
    -        "data": true,
    -        "children": {
    -            "type": "array",
    -            "items": {
    -                "$dynamicRef": "#node"
    -            }
    -        }
    -    }
    -}
    -
    -// strict-tree schema, guards against misspelled properties
    -{
    -    "$schema": "https://json-schema.org/draft/2020-12/schema",
    -    "$id": "https://example.com/strict-tree",
    -    "$dynamicAnchor": "node",
    -
    -    "$ref": "tree",
    -    "unevaluatedProperties": false
    -}
    -
    -// instance with misspelled field
    -{
    -    "children": [ { "daat": 1 } ]
    -}
    -
    -
    -
    -

    - When we load these two schemas, we will notice the "$dynamicAnchor" - named "node" (note the lack of "#" as this is just the name) - present in each, resulting in the following full schema URIs:

    -
      -
    • "https://example.com/tree#node" -
    • -
    • "https://example.com/strict-tree#node" -
    • -
    -

    - In addition, JSON Schema implementations keep track of the fact - that these fragments were created with "$dynamicAnchor".

    -

    - If we apply the "strict-tree" schema to the instance, we will follow - the "$ref" to the "tree" schema, examine its "children" subschema, - and find the "$dynamicRef": to "#node" (note the "#" for URI fragment syntax) - in its "items" subschema. That reference resolves to - "https://example.com/tree#node", which is a URI with a fragment - created by "$dynamicAnchor". Therefore we must examine the dynamic - scope before following the reference.

    -

    - At this point, the dynamic path is - "#/$ref/properties/children/items/$dynamicRef", with a dynamic scope - containing (from the outermost scope to the innermost):

    -
      -
    1. "https://example.com/strict-tree#" -
    2. -
    3. "https://example.com/tree#" -
    4. -
    5. "https://example.com/tree#/properties/children" -
    6. -
    7. "https://example.com/tree#/properties/children/items" -
    8. -
    -

    - Since we are looking for a plain name fragment, which can be - defined anywhere within a schema resource, the JSON Pointer fragments - are irrelevant to this check. That means that we can remove those - fragments and eliminate consecutive duplicates, producing:

    -
      -
    1. "https://example.com/strict-tree" -
    2. -
    3. "https://example.com/tree" -
    4. -
    -

    - In this case, the outermost resource also has a "node" fragment - defined by "$dynamicAnchor". Therefore instead of resolving the - "$dynamicRef" to "https://example.com/tree#node", we resolve it to - "https://example.com/strict-tree#node".

    -

    - This way, the recursion in the "tree" schema recurses to the root - of "strict-tree", instead of only applying "strict-tree" to the - instance root, but applying "tree" to instance children.

    -

    - This example shows both "$dynamicAnchor"s in the same place - in each schema, specifically the resource root schema. - Since plain-name fragments are independent of the JSON structure, - this would work just as well if one or both of the node schema objects - were moved under "$defs". It is the matching "$dynamicAnchor" values - which tell us how to resolve the dynamic reference, not any sort of - correlation in JSON structure.

    -
    -
    -
    -

    -Appendix D. Working with vocabularies -

    -
    -

    -D.1. Best practices for vocabulary and meta-schema authors -

    -

    - Vocabulary authors should - take care to avoid keyword name collisions if the vocabulary is intended - for broad use, and potentially combined with other vocabularies. JSON - Schema does not provide any formal namespacing system, but also does - not constrain keyword names, allowing for any number of namespacing - approaches.

    -

    - Vocabularies may build on each other, such as by defining the behavior - of their keywords with respect to the behavior of keywords from another - vocabulary, or by using a keyword from another vocabulary with - a restricted or expanded set of acceptable values. Not all such - vocabulary re-use will result in a new vocabulary that is compatible - with the vocabulary on which it is built. Vocabulary authors should - clearly document what level of compatibility, if any, is expected.

    -

    - Meta-schema authors should not use "$vocabulary" to combine multiple - vocabularies that define conflicting syntax or semantics for the same - keyword. As semantic conflicts are not generally detectable through - schema validation, implementations are not expected to detect such - conflicts. If conflicting vocabularies are declared, the resulting - behavior is undefined.

    -

    - Vocabulary authors SHOULD provide a meta-schema that validates the - expected usage of the vocabulary's keywords on their own. Such meta-schemas - SHOULD not forbid additional keywords, and MUST not forbid any - keywords from the Core vocabulary.

    -

    - It is recommended that meta-schema authors reference each vocabulary's - meta-schema using the "allOf" (Section 10.2.1.1) keyword, - although other mechanisms for constructing the meta-schema may be - appropriate for certain use cases.

    -

    - The recursive nature of meta-schemas makes the "$dynamicAnchor" - and "$dynamicRef" keywords particularly useful for extending - existing meta-schemas, as can be seen in the JSON Hyper-Schema meta-schema - which extends the Validation meta-schema.

    -

    - Meta-schemas may impose additional constraints, including describing - keywords not present in any vocabulary, beyond what the meta-schemas - associated with the declared vocabularies describe. This allows for - restricting usage to a subset of a vocabulary, and for validating - locally defined keywords not intended for re-use.

    -

    - However, meta-schemas should not contradict any vocabularies that - they declare, such as by requiring a different JSON type than - the vocabulary expects. The resulting behavior is undefined.

    -

    - Meta-schemas intended for local use, with no need to test for - vocabulary support in arbitrary implementations, can safely omit - "$vocabulary" entirely.

    -
    -
    -
    -

    -D.2. Example meta-schema with vocabulary declarations -

    -

    - This meta-schema explicitly declares both the Core and Applicator vocabularies, - together with an extension vocabulary, and combines their meta-schemas with - an "allOf". The extension vocabulary's meta-schema, which describes only the - keywords in that vocabulary, is shown after the main example meta-schema.

    -

    - The main example meta-schema also restricts the usage of the Unevaluated - vocabulary by forbidding the keywords prefixed with "unevaluated", which - are particularly complex to implement. This does not change the semantics - or set of keywords defined by the other vocabularies. It just ensures - that schemas using this meta-schema that attempt to use the keywords - prefixed with "unevaluated" will fail validation against this meta-schema.

    -

    - Finally, this meta-schema describes the syntax of a keyword, "localKeyword", - that is not part of any vocabulary. Presumably, the implementors and users - of this meta-schema will understand the semantics of "localKeyword". - JSON Schema does not define any mechanism for expressing keyword semantics - outside of vocabularies, making them unsuitable for use except in a - specific environment in which they are understood.

    -

    - This meta-schema combines several vocabularies for general use.

    -
    -
    -
    -{
    -  "$schema": "https://json-schema.org/draft/2020-12/schema",
    -  "$id": "https://example.com/meta/general-use-example",
    -  "$dynamicAnchor": "meta",
    -  "$vocabulary": {
    -    "https://json-schema.org/draft/2020-12/vocab/core": true,
    -    "https://json-schema.org/draft/2020-12/vocab/applicator": true,
    -    "https://json-schema.org/draft/2020-12/vocab/validation": true,
    -    "https://example.com/vocab/example-vocab": true
    -  },
    -  "allOf": [
    -    {"$ref": "https://json-schema.org/draft/2020-12/meta/core"},
    -    {"$ref": "https://json-schema.org/draft/2020-12/meta/applicator"},
    -    {"$ref": "https://json-schema.org/draft/2020-12/meta/validation"},
    -    {"$ref": "https://example.com/meta/example-vocab"}
    -  ],
    -  "patternProperties": {
    -    "^unevaluated": false
    -  },
    -  "properties": {
    -    "localKeyword": {
    -      "$comment": "Not in vocabulary, but validated if used",
    -      "type": "string"
    -    }
    -  }
    -}
    -
    -
    -
    -

    - This meta-schema describes only a single extension vocabulary.

    -
    -
    -
    -{
    -  "$schema": "https://json-schema.org/draft/2020-12/schema",
    -  "$id": "https://example.com/meta/example-vocab",
    -  "$dynamicAnchor": "meta",
    -  "$vocabulary": {
    -    "https://example.com/vocab/example-vocab": true,
    -  },
    -  "type": ["object", "boolean"],
    -  "properties": {
    -    "minDate": {
    -      "type": "string",
    -      "pattern": "\d\d\d\d-\d\d-\d\d",
    -      "format": "date",
    -    }
    -  }
    -}
    -
    -
    -
    -

    - As shown above, even though each of the single-vocabulary meta-schemas - referenced in the general-use meta-schema's "allOf" declares its - corresponding vocabulary, this new meta-schema must re-declare them.

    -

    - The standard meta-schemas that combine all vocabularies defined by - the Core and Validation specification, and that combine all vocabularies - defined by those specifications as well as the Hyper-Schema specification, - demonstrate additional complex combinations. These URIs for these - meta-schemas may be found in the Validation and Hyper-Schema specifications, - respectively.

    -

    - While the general-use meta-schema can validate the syntax of "minDate", - it is the vocabulary that defines the logic behind the semantic meaning - of "minDate". Without an understanding of the semantics (in this example, - that the instance value must be a date equal to or after the date - provided as the keyword's value in the schema), an implementation can - only validate the syntactic usage. In this case, that means validating - that it is a date-formatted string (using "pattern" to ensure that it is - validated even when "format" functions purely as an annotation, as explained - in the Validation specification [json-schema-validation].

    -
    -
    -
    -
    -

    -Appendix E. References and generative use cases -

    -

    - While the presence of references is expected to be transparent - to validation results, generative use cases such as code generators - and UI renderers often consider references to be semantically significant.

    -

    - To make such use case-specific semantics explicit, the best practice - is to create an annotation keyword for use in the same - schema object alongside of a reference keyword such as "$ref".

    -

    - For example, here is a hypothetical keyword for determining - whether a code generator should consider the reference - target to be a distinct class, and how those classes are related. - Note that this example is solely for illustrative purposes, and is - not intended to propose a functional code generation keyword.

    -
    -
    -
    -{
    -    "allOf": [
    -        {
    -            "classRelation": "is-a",
    -            "$ref": "classes/base.json"
    -        },
    -        {
    -            "$ref": "fields/common.json"
    -        }
    -    ],
    -    "properties": {
    -        "foo": {
    -            "classRelation": "has-a",
    -            "$ref": "classes/foo.json"
    -        },
    -        "date": {
    -            "$ref": "types/dateStruct.json",
    -        }
    -    }
    -}
    -
    -
    -
    -

    - Here, this schema represents some sort of object-oriented class. - The first reference in the "allOf" is noted as the base class. - The second is not assigned a class relationship, meaning that the - code generator should combine the target's definition with this - one as if no reference were involved.

    -

    - Looking at the properties, "foo" is flagged as object composition, - while the "date" property is not. It is simply a field with - sub-fields, rather than an instance of a distinct class.

    -

    - This style of usage requires the annotation to be in the same object - as the reference, which must be recognizable as a reference.

    -
    -
    -

    -Appendix F. Acknowledgments -

    -

    - Thanks to - Gary Court, - Francis Galiegue, - Kris Zyp, - and Geraint Luff - for their work on the initial drafts of JSON Schema.

    -

    - Thanks to - Jason Desrosiers, - Daniel Perrett, - Erik Wilde, - Evgeny Poberezkin, - Brad Bowman, - Gowry Sankar, - Donald Pipowitch, - Dave Finlay, - Denis Laxalde, - Phil Sturgeon, - Shawn Silverman, - and Karen Etheridge - for their submissions and patches to the document.

    -
    -
    -

    -Appendix G. ChangeLog -

    -

    - This section to be removed before leaving Internet-Draft status.

    -
    -
    draft-bhutton-json-schema-00
    -
    -
      -
    • "$schema" MAY change for embedded resources -
    • -
    • Array-value "items" functionality is now "prefixItems" -
    • -
    • "items" subsumes the old function of "additionalItems" -
    • -
    • "contains" annotation behavior, and "contains" and "unevaluatedItems" interactions now specified -
    • -
    • Rename $recursive* to $dynamic*, with behavior modification -
    • -
    • $dynamicAnchor defines a fragment like $anchor -
    • -
    • $dynamic* (previously $recursive) no longer use runtime base URI determination -
    • -
    • Define Compound Schema Documents (bundle) and processing -
    • -
    • Reference ECMA-262, 11th edition for regular expression support -
    • -
    • Regular expression should support unicode -
    • -
    • Remove media type parameters -
    • -
    • Specify Unknown keywords are collected as annotations -
    • -
    • Moved "unevaluatedItems" and "unevaluatedProperties" from core into their own vocabulary -
    • -
    -
    -
    -
    draft-handrews-json-schema-02
    -
    -
      -
    • Update to RFC 8259 for JSON specification -
    • -
    • Moved "definitions" from the Validation specification here as "$defs" -
    • -
    • Moved applicator keywords from the Validation specification as their own vocabulary -
    • -
    • Moved the schema form of "dependencies" from the Validation specification as "dependentSchemas" -
    • -
    • Formalized annotation collection -
    • -
    • Specified recommended output formats -
    • -
    • Defined keyword interactions in terms of annotation and assertion results -
    • -
    • Added "unevaluatedProperties" and "unevaluatedItems" -
    • -
    • Define "$ref" behavior in terms of the assertion, applicator, and annotation model -
    • -
    • Allow keywords adjacent to "$ref" -
    • -
    • Note undefined behavior for "$ref" targets involving unknown keywords -
    • -
    • Add recursive referencing, primarily for meta-schema extension -
    • -
    • Add the concept of formal vocabularies, and how they can be recognized through meta-schemas -
    • -
    • Additional guidance on initial base URIs beyond network retrieval -
    • -
    • Allow "schema" media type parameter for "application/schema+json" -
    • -
    • Better explanation of media type parameters and the HTTP Accept header -
    • -
    • Use "$id" to establish canonical and base absolute-URIs only, no fragments -
    • -
    • Replace plain-name-fragment-only form of "$id" with "$anchor" -
    • -
    • Clarified that the behavior of JSON Pointers across "$id" boundary is unreliable -
    • -
    -
    -
    -
    draft-handrews-json-schema-01
    -
    -
      -
    • This draft is purely a clarification with no functional changes -
    • -
    • Emphasized annotations as a primary usage of JSON Schema -
    • -
    • Clarified $id by use cases -
    • -
    • Exhaustive schema identification examples -
    • -
    • Replaced "external referencing" with how and when an implementation might know of a schema from another document -
    • -
    • Replaced "internal referencing" with how an implementation should recognized schema identifiers during parsing -
    • -
    • Dereferencing the former "internal" or "external" references is always the same process -
    • -
    • Minor formatting improvements -
    • -
    -
    -
    -
    draft-handrews-json-schema-00
    -
    -
      -
    • Make the concept of a schema keyword vocabulary more clear -
    • -
    • Note that the concept of "integer" is from a vocabulary, not the data model -
    • -
    • Classify keywords as assertions or annotations and describe their general behavior -
    • -
    • Explain the boolean schemas in terms of generalized assertions -
    • -
    • Reserve "$comment" for non-user-visible notes about the schema -
    • -
    • Wording improvements around "$id" and fragments -
    • -
    • Note the challenges of extending meta-schemas with recursive references -
    • -
    • Add "application/schema-instance+json" media type -
    • -
    • Recommend a "schema" link relation / parameter instead of "profile" -
    • -
    -
    -
    -
    draft-wright-json-schema-01
    -
    -
      -
    • Updated intro -
    • -
    • Allowed for any schema to be a boolean -
    • -
    • "$schema" SHOULD NOT appear in subschemas, although that may change -
    • -
    • Changed "id" to "$id"; all core keywords prefixed with "$" -
    • -
    • Clarify and formalize fragments for application/schema+json -
    • -
    • Note applicability to formats such as CBOR that can be represented in the JSON data model -
    • -
    -
    -
    -
    draft-wright-json-schema-00
    -
    -
      -
    • Updated references to JSON -
    • -
    • Updated references to HTTP -
    • -
    • Updated references to JSON Pointer -
    • -
    • Behavior for "id" is now specified in terms of RFC3986 -
    • -
    • Aligned vocabulary usage for URIs with RFC3986 -
    • -
    • Removed reference to draft-pbryan-zyp-json-ref-03 -
    • -
    • Limited use of "$ref" to wherever a schema is expected -
    • -
    • Added definition of the "JSON Schema data model" -
    • -
    • Added additional security considerations -
    • -
    • Defined use of subschema identifiers for "id" -
    • -
    • Rewrote section on usage with HTTP -
    • -
    • Rewrote section on usage with rel="describedBy" and rel="profile" -
    • -
    • Fixed numerous invalid examples -
    • -
    -
    -
    -
    draft-zyp-json-schema-04
    -
    -
      -
    • Salvaged from draft v3. -
    • -
    • Split validation keywords into separate document. -
    • -
    • Split hypermedia keywords into separate document. -
    • -
    • Initial post-split draft. -
    • -
    • Mandate the use of JSON Reference, JSON Pointer. -
    • -
    • Define the role of "id". Define URI resolution scope. -
    • -
    • Add interoperability considerations. -
    • -
    -
    -
    -
    draft-zyp-json-schema-00
    -
    -
      -
    • Initial draft. -
    • -
    -
    -
    -
    -
    -
    -
    -

    -Authors' Addresses -

    -
    -
    Austin Wright (editor)
    - -
    -
    -
    Henry Andrews (editor)
    - -
    -
    -
    Ben Hutton (editor)
    - - -
    -
    -
    Greg Dennis
    - - -
    -
    -
    - - - diff --git a/draft/preview/2020-12-p1-rc-0/jsonschema-validation.html b/draft/preview/2020-12-p1-rc-0/jsonschema-validation.html deleted file mode 100644 index 758eeeb3..00000000 --- a/draft/preview/2020-12-p1-rc-0/jsonschema-validation.html +++ /dev/null @@ -1,3173 +0,0 @@ - - - - - - -JSON Schema Validation: A Vocabulary for Structural Validation of JSON - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Internet-DraftJSON Schema ValidationApril 2022
    Wright, et al.Expires 30 October 2022[Page]
    -
    -
    -
    -
    Workgroup:
    -
    Internet Engineering Task Force
    -
    Internet-Draft:
    -
    draft-bhutton-json-schema-validation-01
    -
    Published:
    -
    - -
    -
    Intended Status:
    -
    Informational
    -
    Expires:
    -
    -
    Authors:
    -
    -
    -
    A. Wright, Ed. -
    -
    -
    -
    H. Andrews, Ed. -
    -
    -
    -
    B. Hutton, Ed. -
    -
    -
    -
    -
    -

    JSON Schema Validation: A Vocabulary for Structural Validation of JSON

    -
    -

    Abstract

    -

    - JSON Schema (application/schema+json) has several purposes, one of which is JSON - instance validation. - This document specifies a vocabulary for JSON Schema to describe the meaning of JSON - documents, provide hints for user interfaces working with JSON data, and to make - assertions about what a valid document must look like.

    -
    -
    -

    -Note to Readers -

    -

    - The issues list for this draft can be found at - https://github.com/json-schema-org/json-schema-spec/issues.

    -

    - For additional information, see https://json-schema.org/.

    -

    - To provide feedback, use this issue tracker, the communication methods listed on the - homepage, or email the document editors.

    -
    -
    -
    -

    -Status of This Memo -

    -

    - This Internet-Draft is submitted in full conformance with the - provisions of BCP 78 and BCP 79.

    -

    - Internet-Drafts are working documents of the Internet Engineering Task - Force (IETF). Note that other groups may also distribute working - documents as Internet-Drafts. The list of current Internet-Drafts is - at https://datatracker.ietf.org/drafts/current/.

    -

    - Internet-Drafts are draft documents valid for a maximum of six months - and may be updated, replaced, or obsoleted by other documents at any - time. It is inappropriate to use Internet-Drafts as reference - material or to cite them other than as "work in progress."

    -

    - This Internet-Draft will expire on 30 October 2022.

    -
    -
    - -
    -
    -

    -Table of Contents -

    - -
    -
    -
    -

    -1. Introduction -

    -

    - JSON Schema can be used to require that a given JSON document (an instance) - satisfies a certain number of criteria. These criteria are asserted by using - keywords described in this specification. In addition, a set of keywords - is also defined to assist in interactive user interface instance generation.

    -

    - This specification will use the concepts, syntax, and terminology defined - by the JSON Schema core [json-schema] specification.

    -
    -
    -

    -2. Conventions and Terminology -

    -

    - - - The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", - "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be - interpreted as described in RFC 2119 [RFC2119].

    -

    - This specification uses the term "container instance" to refer to both array and - object instances. It uses the term "children instances" to refer to array elements - or object member values.

    -

    - Elements in an array value are said to be unique if no two elements of this array - are equal [json-schema].

    -
    -
    -

    -3. Overview -

    -

    - JSON Schema validation asserts constraints on the structure of instance data. - An instance location that satisfies all asserted constraints is then - annotated with any keywords that contain non-assertion information, - such as descriptive metadata and usage hints. If all locations within - the instance satisfy all asserted constraints, then the instance is - said to be valid against the schema.

    -

    - Each schema object is independently evaluated against each instance location - to which it applies. This greatly simplifies the implementation requirements - for validators by ensuring that they do not need to maintain state across - the document-wide validation process.

    -

    - This specification defines a set of assertion keywords, as well as a small vocabulary - of metadata keywords that can be used to annotate the JSON instance with - useful information. The Section 7 keyword is intended primarily - as an annotation, but can optionally be used as an assertion. The - Section 8 keywords are annotations for working with documents - embedded as JSON strings.

    -
    -
    -

    -4. Interoperability Considerations -

    -
    -

    -4.1. Validation of String Instances -

    -

    - It should be noted that the nul character (\u0000) is valid in a JSON string. An - instance to validate may contain a string value with this character, regardless - of the ability of the underlying programming language to deal with such data.

    -
    -
    -

    -4.2. Validation of Numeric Instances -

    -

    - The JSON specification allows numbers with arbitrary precision, and JSON Schema - does not add any such bounds. - This means that numeric instances processed by JSON Schema can be arbitrarily large and/or - have an arbitrarily long decimal part, regardless of the ability of the - underlying programming language to deal with such data.

    -
    -
    -
    -

    -4.3. Regular Expressions -

    -

    - Keywords that use regular expressions, or constrain the instance value - to be a regular expression, are subject to the interoperability - considerations for regular expressions in the - JSON Schema Core [json-schema] specification.

    -
    -
    -
    -
    -
    -

    -5. Meta-Schema -

    -

    - The current URI for the default JSON Schema dialect meta-schema is - https://json-schema.org/draft/2020-12/schema. - For schema author convenience, this meta-schema describes a dialect - consisting of all vocabularies - defined in this specification and the JSON Schema Core specification, - as well as two former keywords which are reserved for a transitional period. - Individual vocabulary and vocabulary meta-schema URIs are given for - each section below. Certain vocabularies are optional to support, which - is explained in detail in the relevant sections.

    -

    - Updated vocabulary and meta-schema URIs MAY be published between - specification drafts in order to correct errors. Implementations - SHOULD consider URIs dated after this specification draft and - before the next to indicate the same syntax and semantics - as those listed here.

    -
    -
    -
    -

    -6. A Vocabulary for Structural Validation -

    -

    - Validation keywords in a schema impose requirements for successful validation of an - instance. These keywords are all assertions without any annotation behavior.

    -

    - Meta-schemas that do not use "$vocabulary" SHOULD be considered to - require this vocabulary as if its URI were present with a value of true.

    -

    - The current URI for this vocabulary, known as the Validation vocabulary, is: - <https://json-schema.org/draft/2020-12/vocab/validation>.

    -

    - The current URI for the corresponding meta-schema is: - https://json-schema.org/draft/2020-12/meta/validation.

    -
    -
    -

    -6.1. Validation Keywords for Any Instance Type -

    -
    -

    -6.1.1. type -

    -

    - The value of this keyword MUST be either a string or an array. If it is - an array, elements of the array MUST be strings and MUST be unique.

    -

    - String values MUST be one of the six primitive types - ("null", "boolean", "object", "array", "number", or "string"), - or "integer" which matches any number with a zero fractional part.

    -

    - If the value of "type" is a string, then an instance validates successfully if - its type matches the type represented by the value of the string. - - If the value of "type" is an array, then an instance validates successfully if - its type matches any of the types indicated by the strings in the array.

    -
    -
    -
    -

    -6.1.2. enum -

    -

    - The value of this keyword MUST be an array. This array SHOULD have at - least one element. Elements in the array SHOULD be unique.

    -

    - An instance validates successfully against this keyword if its value is - equal to one of the elements in this keyword's array value.

    -

    - Elements in the array might be of any type, including null.

    -
    -
    -
    -

    -6.1.3. const -

    -

    - The value of this keyword MAY be of any type, including null.

    -

    - Use of this keyword is functionally equivalent to an - "enum" (Section 6.1.2) with a single value.

    -

    - An instance validates successfully against this keyword if its value is - equal to the value of the keyword.

    -
    -
    -
    -
    -
    -

    -6.2. Validation Keywords for Numeric Instances (number and integer) -

    -
    -

    -6.2.1. multipleOf -

    -

    - The value of "multipleOf" MUST be a number, strictly greater than 0.

    -

    - A numeric instance is valid only if division by this keyword's value results in - an integer.

    -
    -
    -

    -6.2.2. maximum -

    -

    - The value of "maximum" MUST be a number, representing an inclusive upper limit - for a numeric instance.

    -

    - If the instance is a number, then this keyword validates only if the instance is - less than or exactly equal to "maximum".

    -
    -
    -

    -6.2.3. exclusiveMaximum -

    -

    - The value of "exclusiveMaximum" MUST be a number, representing an exclusive upper - limit for a numeric instance.

    -

    - If the instance is a number, then the instance is valid only if it has a value - strictly less than (not equal to) "exclusiveMaximum".

    -
    -
    -

    -6.2.4. minimum -

    -

    - The value of "minimum" MUST be a number, representing an inclusive lower limit - for a numeric instance.

    -

    - If the instance is a number, then this keyword validates only if the instance is - greater than or exactly equal to "minimum".

    -
    -
    -

    -6.2.5. exclusiveMinimum -

    -

    - The value of "exclusiveMinimum" MUST be a number, representing an exclusive lower - limit for a numeric instance.

    -

    - If the instance is a number, then the instance is valid only if it has a value - strictly greater than (not equal to) "exclusiveMinimum".

    -
    -
    -
    -
    -
    -

    -6.3. Validation Keywords for Strings -

    -
    -

    -6.3.1. maxLength -

    -

    - The value of this keyword MUST be a non-negative integer.

    -

    - A string instance is valid against this keyword if its - length is less than, or equal to, the value of this keyword.

    -

    - The length of a string instance is defined as the number of its - characters as defined by RFC 8259 [RFC8259].

    -
    -
    -

    -6.3.2. minLength -

    -

    - The value of this keyword MUST be a non-negative integer.

    -

    - A string instance is valid against this keyword if its - length is greater than, or equal to, the value of this keyword.

    -

    - The length of a string instance is defined as the number of its - characters as defined by RFC 8259 [RFC8259].

    -

    - Omitting this keyword has the same behavior as a value of 0.

    -
    -
    -
    -

    -6.3.3. pattern -

    -

    - The value of this keyword MUST be a string. This string SHOULD be a - valid regular expression, according to the ECMA-262 regular expression - dialect.

    -

    - A string instance is considered valid if the regular - expression matches the instance successfully. Recall: regular - expressions are not implicitly anchored.

    -
    -
    -
    -
    -
    -

    -6.4. Validation Keywords for Arrays -

    -
    -

    -6.4.1. maxItems -

    -

    - The value of this keyword MUST be a non-negative integer.

    -

    - An array instance is valid against "maxItems" if its size is - less than, or equal to, the value of this keyword.

    -
    -
    -

    -6.4.2. minItems -

    -

    - The value of this keyword MUST be a non-negative integer.

    -

    - An array instance is valid against "minItems" if its size is - greater than, or equal to, the value of this keyword.

    -

    - Omitting this keyword has the same behavior as a value of 0.

    -
    -
    -

    -6.4.3. uniqueItems -

    -

    - The value of this keyword MUST be a boolean.

    -

    - If this keyword has boolean value false, the instance validates - successfully. If it has boolean value true, the instance validates - successfully if all of its elements are unique.

    -

    - Omitting this keyword has the same behavior as a value of false.

    -
    -
    -

    -6.4.4. maxContains -

    -

    - The value of this keyword MUST be a non-negative integer.

    -

    - If "contains" is not present within the same schema object, - then this keyword has no effect.

    -

    - An instance array is valid against "maxContains" in two ways, depending on - the form of the annotation result of an adjacent - "contains" [json-schema] keyword. The first way is if - the annotation result is an array and the length of that array is less than - or equal to the "maxContains" value. The second way is if the annotation - result is a boolean "true" and the instance array length is less than or - equal to the "maxContains" value.

    -
    -
    -

    -6.4.5. minContains -

    -

    - The value of this keyword MUST be a non-negative integer.

    -

    - If "contains" is not present within the same schema object, - then this keyword has no effect.

    -

    - An instance array is valid against "minContains" in two ways, depending on - the form of the annotation result of an adjacent - "contains" [json-schema] keyword. The first way is if - the annotation result is an array and the length of that array is greater - than or equal to the "minContains" value. The second way is if the - annotation result is a boolean "true" and the instance array length is - greater than or equal to the "minContains" value.

    -

    - A value of 0 is allowed, but is only useful for setting a range - of occurrences from 0 to the value of "maxContains". A value of - 0 causes "minContains" to always pass validation (but validation can - still fail against a "maxContains" keyword).

    -

    - Omitting this keyword has the same behavior as a value of 1.

    -
    -
    -
    -

    -6.5. Validation Keywords for Objects -

    -
    -

    -6.5.1. maxProperties -

    -

    - The value of this keyword MUST be a non-negative integer.

    -

    - An object instance is valid against "maxProperties" if its - number of properties is less than, or equal to, the value of this - keyword.

    -
    -
    -

    -6.5.2. minProperties -

    -

    - The value of this keyword MUST be a non-negative integer.

    -

    - An object instance is valid against "minProperties" if its - number of properties is greater than, or equal to, the value of this - keyword.

    -

    - Omitting this keyword has the same behavior as a value of 0.

    -
    -
    -

    -6.5.3. required -

    -

    - The value of this keyword MUST be an array. - Elements of this array, if any, MUST be strings, and MUST be unique.

    -

    - An object instance is valid against this keyword if every item in the array is - the name of a property in the instance.

    -

    - Omitting this keyword has the same behavior as an empty array.

    -
    -
    -

    -6.5.4. dependentRequired -

    -

    - The value of this keyword MUST be an object. Properties in - this object, if any, MUST be arrays. Elements in each array, - if any, MUST be strings, and MUST be unique.

    -

    - This keyword specifies properties that are required if a specific - other property is present. Their requirement is dependent on the - presence of the other property.

    -

    - Validation succeeds if, for each name that appears in both - the instance and as a name within this keyword's value, every - item in the corresponding array is also the name of a property - in the instance.

    -

    - Omitting this keyword has the same behavior as an empty object.

    -
    -
    -
    -
    -
    -

    -7. Vocabularies for Semantic Content With "format" -

    -
    -

    -7.1. Foreword -

    -

    - Structural validation alone may be insufficient to allow an application to correctly - utilize certain values. The "format" annotation keyword is defined to allow schema - authors to convey semantic information for a fixed subset of values which are - accurately described by authoritative resources, be they RFCs or other external - specifications.

    -

    - The value of this keyword is called a format attribute. It MUST be a string. A - format attribute can generally only validate a given set of instance types. If - the type of the instance to validate is not in this set, validation for this - format attribute and instance SHOULD succeed. All format attributes defined - in this section apply to strings, but a format attribute can be specified - to apply to any instance types defined in the data model defined in the - core JSON Schema. [json-schema] - - Note that the "type" keyword in this specification defines an "integer" type - which is not part of the data model. Therefore a format attribute can be - limited to numbers, but not specifically to integers. However, a numeric - format can be used alongside the "type" keyword with a value of "integer", - or could be explicitly defined to always pass if the number is not an integer, - which produces essentially the same behavior as only applying to integers. -

    -

    - The current URI for this vocabulary, known as the Format-Annotation vocabulary, is: - <https://json-schema.org/draft/2020-12/vocab/format-annotation>. The current - URI for the corresponding meta-schema is: - https://json-schema.org/draft/2020-12/meta/format-annotation. - Implementing support for this vocabulary is REQUIRED.

    -

    - In addition to the Format-Annotation vocabulary, a secondary vocabulary is available - for custom meta-schemas that defines "format" as an assertion. The URI for the - Format-Assertion vocabulary, is: - <https://json-schema.org/draft/2020-12/vocab/format-assertion>. The current - URI for the corresponding meta-schema is: - https://json-schema.org/draft/2020-12/meta/format-assertion. - Implementing support for the Format-Assertion vocabulary is OPTIONAL.

    -

    - Specifying both the Format-Annotation and the Format-Assertion vocabularies is functionally - equivalent to specifying only the Format-Assertion vocabulary since its requirements - are a superset of the Format-Annotation vocabulary.

    -
    -
    -

    -7.2. Implementation Requirements -

    -

    - The "format" keyword functions as defined by the vocabulary which is referenced.

    -
    -

    -7.2.1. Format-Annotation Vocabulary -

    -

    - The value of format MUST be collected as an annotation, if the implementation - supports annotation collection. This enables application-level validation when - schema validation is unavailable or inadequate.

    -

    - Implementations MAY still treat "format" as an assertion in addition to an - annotation and attempt to validate the value's conformance to the specified - semantics. The implementation MUST provide options to enable and disable such - evaluation and MUST be disabled by default. Implementations SHOULD document - their level of support for such validation. - - Specifying the Format-Annotation vocabulary and enabling validation in an - implementation should not be viewed as being equivalent to specifying - the Format-Assertion vocabulary since implementations are not required to - provide full validation support when the Format-Assertion vocabulary - is not specified. -

    -

    - When the implementation is configured for assertion behavior, it:

    -
      -
    • - SHOULD provide an implementation-specific best effort validation - for each format attribute defined below; -
    • -
    • - MAY choose to implement validation of any or all format attributes - as a no-op by always producing a validation result of true; -
    • -
    -

    - - This matches the current reality of implementations, which provide - widely varying levels of validation, including no validation at all, - for some or all format attributes. It is also designed to encourage - relying only on the annotation behavior and performing semantic - validation in the application, which is the recommended best practice. -

    -
    -
    -

    -7.2.2. Format-Assertion Vocabulary -

    -

    - When the Format-Assertion vocabulary is declared with a value of true, - implementations MUST provide full validation support for all of the formats - defined by this specificaion. Implementations that cannot provide full - validation support MUST refuse to process the schema.

    -

    - An implementation that supports the Format-Assertion vocabulary:

    -
      -
    • - MUST still collect "format" as an annotation if the implementation - supports annotation collection; -
    • -
    • - MUST evaluate "format" as an assertion; -
    • -
    • - MUST implement syntactic validation for all format attributes defined - in this specification, and for any additional format attributes that - it recognizes, such that there exist possible instance values - of the correct type that will fail validation. -
    • -
    -

    - The requirement for minimal validation of format attributes is intentionally - vague and permissive, due to the complexity involved in many of the attributes. - Note in particular that the requirement is limited to syntactic checking; it is - not to be expected that an implementation would send an email, attempt to connect - to a URL, or otherwise check the existence of an entity identified by a format - instance. - - The expectation is that for simple formats such as date-time, syntactic - validation will be thorough. For a complex format such as email addresses, - which are the amalgamation of various standards and numerous adjustments - over time, with obscure and/or obsolete rules that may or may not be - restricted by other applications making use of the value, a minimal validation - is sufficient. For example, an instance string that does not contain - an "@" is clearly not a valid email address, and an "email" or "hostname" - containing characters outside of 7-bit ASCII is likewise clearly invalid. -

    -

    - It is RECOMMENDED that implementations use a common parsing library for each format, - or a well-known regular expression. Implementations SHOULD clearly document - how and to what degree each format attribute is validated.

    -

    - The standard core and validation meta-schema (Section 5) - includes this vocabulary in its "$vocabulary" keyword with a value of false, - since by default implementations are not required to support this keyword - as an assertion. Supporting the format vocabulary with a value of true is - understood to greatly increase code size and in some cases execution time, - and will not be appropriate for all implementations.

    -
    -
    -

    -7.2.3. Custom format attributes -

    -

    - Implementations MAY support custom format attributes. Save for agreement between - parties, schema authors SHALL NOT expect a peer implementation to support such - custom format attributes. An implementation MUST NOT fail to collect unknown formats - as annotations. When the Format-Assertion vocabulary is specified, implementations - MUST fail upon encountering unknown formats.

    -

    - Vocabularies do not support specifically declaring different value sets for keywords. - Due to this limitation, and the historically uneven implementation of this keyword, - it is RECOMMENDED to define additional keywords in a custom vocabulary rather than - additional format attributes if interoperability is desired.

    -
    -
    -
    -

    -7.3. Defined Formats -

    -
    -

    -7.3.1. Dates, Times, and Duration -

    -

    - These attributes apply to string instances.

    -

    - Date and time format names are derived from - RFC 3339, section 5.6 [RFC3339]. - The duration format is from the ISO 8601 ABNF as given - in Appendix A of RFC 3339.

    -

    - Implementations supporting formats SHOULD implement support for - the following attributes:

    -
    -
    date-time:
    -
    - A string instance is valid against this attribute if it is - a valid representation according to the "date-time' ABNF rule - (referenced above) -
    -
    -
    date:
    -
    - A string instance is valid against this attribute if it is - a valid representation according to the "full-date" ABNF rule - (referenced above) -
    -
    -
    time:
    -
    - A string instance is valid against this attribute if it is - a valid representation according to the "full-time" ABNF rule - (referenced above) -
    -
    -
    duration:
    -
    - A string instance is valid against this attribute if it is - a valid representation according to the "duration" ABNF rule - (referenced above) -
    -
    -
    -

    - Implementations MAY support additional attributes using the other - format names defined anywhere in that RFC. If "full-date" or "full-time" - are implemented, the corresponding short form ("date" or "time" - respectively) MUST be implemented, and MUST behave identically. - Implementations SHOULD NOT define extension attributes - with any name matching an RFC 3339 format unless it validates - according to the rules of that format. - - There is not currently consensus on the need for supporting - all RFC 3339 formats, so this approach of reserving the - namespace will encourage experimentation without committing - to the entire set. Either the format implementation requirements - will become more flexible in general, or these will likely - either be promoted to fully specified attributes or dropped. -

    -
    -
    -

    -7.3.2. Email Addresses -

    -

    - These attributes apply to string instances.

    -

    - A string instance is valid against these attributes if it is a valid - Internet email address as follows:

    -
    -
    email:
    -
    - As defined by the "Mailbox" ABNF rule in - RFC 5321, section 4.1.2 [RFC5321]. -
    -
    -
    idn-email:
    -
    - As defined by the extended "Mailbox" ABNF rule in - RFC 6531, section 3.3 [RFC6531]. -
    -
    -
    -

    - Note that all strings valid against the "email" attribute are also - valid against the "idn-email" attribute.

    -
    -
    -

    -7.3.3. Hostnames -

    -

    - These attributes apply to string instances.

    -

    - A string instance is valid against these attributes if it is a valid - representation for an Internet hostname as follows:

    -
    -
    hostname:
    -
    - As defined by RFC 1123, section 2.1 [RFC1123], - including host names produced using the Punycode algorithm - specified in RFC 5891, section 4.4 [RFC5891]. -
    -
    -
    idn-hostname:
    -
    - As defined by either RFC 1123 as for hostname, or an - internationalized hostname as defined by - RFC 5890, section 2.3.2.3 [RFC5890]. -
    -
    -
    -

    - Note that all strings valid against the "hostname" attribute are also - valid against the "idn-hostname" attribute.

    -
    -
    -

    -7.3.4. IP Addresses -

    -

    - These attributes apply to string instances.

    -

    - A string instance is valid against these attributes if it is a valid - representation of an IP address as follows:

    -
    -
    ipv4:
    -
    - An IPv4 address according to the "dotted-quad" ABNF - syntax as defined in - RFC 2673, section 3.2 [RFC2673]. -
    -
    -
    ipv6:
    -
    - An IPv6 address as defined in - RFC 4291, section 2.2 [RFC4291]. -
    -
    -
    -
    -
    -

    -7.3.5. Resource Identifiers -

    -

    - These attributes apply to string instances.

    -
    -
    uri:
    -
    - A string instance is valid against this attribute if it is - a valid URI, according to [RFC3986]. -
    -
    -
    uri-reference:
    -
    - A string instance is valid against this attribute if it is a valid URI - Reference (either a URI or a relative-reference), - according to [RFC3986]. -
    -
    -
    iri:
    -
    - A string instance is valid against this attribute if it is - a valid IRI, according to [RFC3987]. -
    -
    -
    iri-reference:
    -
    - A string instance is valid against this attribute if it is a valid IRI - Reference (either an IRI or a relative-reference), - according to [RFC3987]. -
    -
    -
    uuid:
    -
    - A string instance is valid against this attribute if it is a valid - string representation of a UUID, according to [RFC4122]. -
    -
    -
    -

    - Note that all valid URIs are valid IRIs, and all valid URI References are - also valid IRI References.

    -

    - Note also that the "uuid" format is for plain UUIDs, not UUIDs in URNs. An example - is "f81d4fae-7dec-11d0-a765-00a0c91e6bf6". For UUIDs as URNs, use the "uri" format, - with a "pattern" regular expression of "^urn:uuid:" to indicate the URI scheme and - URN namespace.

    -
    -
    -

    -7.3.6. uri-template -

    -

    - This attribute applies to string instances.

    -

    - A string instance is valid against this attribute if it is a valid URI Template - (of any level), according to [RFC6570].

    -

    - Note that URI Templates may be used for IRIs; there is no separate - IRI Template specification.

    -
    -
    -

    -7.3.7. JSON Pointers -

    -

    - These attributes apply to string instances.

    -
    -
    json-pointer:
    -
    - A string instance is valid against this attribute if it - is a valid JSON string representation of a JSON Pointer, - according to RFC 6901, section 5 [RFC6901]. -
    -
    -
    relative-json-pointer:
    -
    - A string instance is valid against this attribute if it is a valid - Relative JSON Pointer [relative-json-pointer]. -
    -
    -
    -

    - To allow for both absolute and relative JSON Pointers, use "anyOf" or - "oneOf" to indicate support for either format.

    -
    -
    -

    -7.3.8. regex -

    -

    - This attribute applies to string instances.

    -

    - A regular expression, which SHOULD be valid according to the - ECMA-262 [ecma262] regular expression dialect.

    -

    - Implementations that validate formats MUST accept at least the subset of - ECMA-262 defined in the Regular Expressions (Section 4.3) - section of this specification, and SHOULD accept all valid ECMA-262 expressions.

    -
    -
    -
    -
    -
    -
    -

    -8. A Vocabulary for the Contents of String-Encoded Data -

    -
    -

    -8.1. Foreword -

    -

    - Annotations defined in this section indicate that an instance contains - non-JSON data encoded in a JSON string.

    -

    - These properties provide additional information required to interpret JSON data - as rich multimedia documents. They describe the type of content, how it is encoded, - and/or how it may be validated. They do not function as validation assertions; - a malformed string-encoded document MUST NOT cause the containing instance - to be considered invalid.

    -

    - Meta-schemas that do not use "$vocabulary" SHOULD be considered to - require this vocabulary as if its URI were present with a value of true.

    -

    - The current URI for this vocabulary, known as the Content vocabulary, is: - <https://json-schema.org/draft/2020-12/vocab/content>.

    -

    - The current URI for the corresponding meta-schema is: - https://json-schema.org/draft/2020-12/meta/content.

    -
    -
    -

    -8.2. Implementation Requirements -

    -

    - Due to security and performance concerns, as well as the open-ended nature of - possible content types, implementations MUST NOT automatically decode, parse, - and/or validate the string contents by default. This additionally supports - the use case of embedded documents intended for processing by a different - consumer than that which processed the containing document.

    -

    - All keywords in this section apply only to strings, and have no - effect on other data types.

    -

    - Implementations MAY offer the ability to decode, parse, and/or validate - the string contents automatically. However, it MUST NOT perform these - operations by default, and MUST provide the validation result of each - string-encoded document separately from the enclosing document. This - process SHOULD be equivalent to fully evaluating the instance against - the original schema, followed by using the annotations to decode, parse, - and/or validate each string-encoded document. - - For now, the exact mechanism of performing and returning parsed - data and/or validation results from such an automatic decoding, parsing, - and validating feature is left unspecified. Should such a feature - prove popular, it may be specified more thoroughly in a future draft. -

    -

    - See also the Security Considerations (Section 10) - sections for possible vulnerabilities introduced by automatically - processing the instance string according to these keywords.

    -
    -
    -

    -8.3. contentEncoding -

    -

    - If the instance value is a string, this property defines that the string - SHOULD be interpreted as encoded binary data and decoded using the encoding - named by this property.

    -

    - Possible values indicating base 16, 32, and 64 encodings with several - variations are listed in RFC 4648 [RFC4648]. Additionally, - sections 6.7 and 6.8 of RFC 2045 [RFC2045] provide - encodings used in MIME. This keyword is derived from MIME's - Content-Transfer-Encoding header, which was designed to map binary data - into ASCII characters. It is not related to HTTP's Content-Encoding header, - which is used to encode (e.g. compress or encrypt) - the content of HTTP request and responses.

    -

    - As "base64" is defined in both RFCs, the definition - from RFC 4648 SHOULD be assumed unless the string is specifically intended - for use in a MIME context. Note that all of these encodings result in - strings consisting only of 7-bit ASCII characters. Therefore, this keyword - has no meaning for strings containing characters outside of that range.

    -

    - If this keyword is absent, but "contentMediaType" is present, this - indicates that the encoding is the identity encoding, meaning that - no transformation was needed in order to represent the content in - a UTF-8 string.

    -

    - The value of this property MUST be a string.

    -
    -
    -

    -8.4. contentMediaType -

    -

    - If the instance is a string, this property indicates the media type - of the contents of the string. If "contentEncoding" is present, - this property describes the decoded string.

    -

    - The value of this property MUST be a string, which MUST be a media type, - as defined by RFC 2046 [RFC2046].

    -
    -
    -

    -8.5. contentSchema -

    -

    - If the instance is a string, and if "contentMediaType" is present, this - property contains a schema which describes the structure of the string.

    -

    - This keyword MAY be used with any media type that can be mapped into - JSON Schema's data model.

    -

    - The value of this property MUST be a valid JSON schema. It SHOULD be ignored if - "contentMediaType" is not present.

    -
    -
    -

    -8.6. Example -

    -

    - Here is an example schema, illustrating the use of "contentEncoding" and - "contentMediaType":

    -
    -
    -
    -{
    -    "type": "string",
    -    "contentEncoding": "base64",
    -    "contentMediaType": "image/png"
    -}
    -
    -
    -
    -

    - Instances described by this schema are expected to be strings, - and their values should be interpretable as base64-encoded PNG images.

    -

    - Another example:

    -
    -
    -
    -{
    -    "type": "string",
    -    "contentMediaType": "text/html"
    -}
    -
    -
    -
    -

    - Instances described by this schema are expected to be strings containing HTML, - using whatever character set the JSON string was decoded into. - Per section 8.1 of - RFC 8259 [RFC8259], outside of an entirely closed - system, this MUST be UTF-8.

    -

    - This example describes a JWT that is MACed using the HMAC SHA-256 - algorithm, and requires the "iss" and "exp" fields in its claim set.

    -
    -
    -
    -{
    -    "type": "string",
    -    "contentMediaType": "application/jwt",
    -    "contentSchema": {
    -        "type": "array",
    -        "minItems": 2,
    -        "prefixItems": [
    -            {
    -                "const": {
    -                    "typ": "JWT",
    -                    "alg": "HS256"
    -                }
    -            },
    -            {
    -                "type": "object",
    -                "required": ["iss", "exp"],
    -                "properties": {
    -                    "iss": {"type": "string"},
    -                    "exp": {"type": "integer"}
    -                }
    -            }
    -        ]
    -    }
    -}
    -
    -
    -

    - Note that "contentEncoding" does not appear. While the "application/jwt" - media type makes use of base64url encoding, that is defined by the media - type, which determines how the JWT string is decoded into a list of two - JSON data structures: first the header, and then the payload. Since the - JWT media type ensures that the JWT can be represented in a JSON string, - there is no need for further encoding or decoding.

    -
    -
    -
    -
    -

    -9. A Vocabulary for Basic Meta-Data Annotations -

    -

    - These general-purpose annotation keywords provide commonly used information - for documentation and user interface display purposes. They are not intended - to form a comprehensive set of features. Rather, additional vocabularies - can be defined for more complex annotation-based applications.

    -

    - Meta-schemas that do not use "$vocabulary" SHOULD be considered to - require this vocabulary as if its URI were present with a value of true.

    -

    - The current URI for this vocabulary, known as the Meta-Data vocabulary, is: - <https://json-schema.org/draft/2020-12/vocab/meta-data>.

    -

    - The current URI for the corresponding meta-schema is: - https://json-schema.org/draft/2020-12/meta/meta-data.

    -
    -

    -9.1. "title" and "description" -

    -

    - The value of both of these keywords MUST be a string.

    -

    - Both of these keywords can be used to decorate a user interface with - information about the data produced by this user interface. A title will - preferably be short, whereas a description will provide explanation about - the purpose of the instance described by this schema.

    -
    -
    -

    -9.2. "default" -

    -

    - There are no restrictions placed on the value of this keyword. When - multiple occurrences of this keyword are applicable to a single - sub-instance, implementations SHOULD remove duplicates.

    -

    - This keyword can be used to supply a default JSON value associated with a - particular schema. It is RECOMMENDED that a default value be valid against - the associated schema.

    -
    -
    -

    -9.3. "deprecated" -

    -

    - The value of this keyword MUST be a boolean. When multiple occurrences - of this keyword are applicable to a single sub-instance, applications - SHOULD consider the instance location to be deprecated if any occurrence - specifies a true value.

    -

    - If "deprecated" has a value of boolean true, it indicates that applications - SHOULD refrain from usage of the declared property. It MAY mean the property - is going to be removed in the future.

    -

    - A root schema containing "deprecated" with a value of true indicates that - the entire resource being described MAY be removed in the future.

    -

    - The "deprecated" keyword applies to each instance location to which the - schema object containing the keyword successfully applies. This can - result in scenarios where every array item or object property - is deprecated even though the containing array or object is not.

    -

    - Omitting this keyword has the same behavior as a value of false.

    -
    -
    -

    -9.4. "readOnly" and "writeOnly" -

    -

    - The value of these keywords MUST be a boolean. When multiple occurrences - of these keywords are applicable to a single sub-instance, the resulting - behavior SHOULD be as for a true value if any occurrence specifies a true value, - and SHOULD be as for a false value otherwise.

    -

    - If "readOnly" has a value of boolean true, it indicates that the value - of the instance is managed exclusively by the owning authority, and - attempts by an application to modify the value of this property are - expected to be ignored or rejected by that owning authority.

    -

    - An instance document that is marked as "readOnly" for the entire document - MAY be ignored if sent to the owning authority, or MAY result in an - error, at the authority's discretion.

    -

    - If "writeOnly" has a value of boolean true, it indicates that the value - is never present when the instance is retrieved from the owning authority. - It can be present when sent to the owning authority to update or create - the document (or the resource it represents), but it will not be included - in any updated or newly created version of the instance.

    -

    - An instance document that is marked as "writeOnly" for the entire document - MAY be returned as a blank document of some sort, or MAY produce an error - upon retrieval, or have the retrieval request ignored, at the authority's - discretion.

    -

    - For example, "readOnly" would be used to mark a database-generated serial - number as read-only, while "writeOnly" would be used to mark a password - input field.

    -

    - These keywords can be used to assist in user interface instance generation. - In particular, an application MAY choose to use a widget that hides - input values as they are typed for write-only fields.

    -

    - Omitting these keywords has the same behavior as values of false.

    -
    -
    -

    -9.5. "examples" -

    -

    - The value of this keyword MUST be an array. - There are no restrictions placed on the values within the array. - When multiple occurrences of this keyword are applicable to a single - sub-instance, implementations MUST provide a flat array of all - values rather than an array of arrays.

    -

    - This keyword can be used to provide sample JSON values associated with a - particular schema, for the purpose of illustrating usage. It is - RECOMMENDED that these values be valid against the associated schema.

    -

    - Implementations MAY use the value(s) of "default", if present, as - an additional example. If "examples" is absent, "default" - MAY still be used in this manner.

    -
    -
    -
    -
    -

    -10. Security Considerations -

    -

    - JSON Schema validation defines a vocabulary for JSON Schema core and concerns all - the security considerations listed there.

    -

    - JSON Schema validation allows the use of Regular Expressions, which have numerous - different (often incompatible) implementations. - Some implementations allow the embedding of arbitrary code, which is outside the - scope of JSON Schema and MUST NOT be permitted. - Regular expressions can often also be crafted to be extremely expensive to compute - (with so-called "catastrophic backtracking"), resulting in a denial-of-service - attack.

    -

    - Implementations that support validating or otherwise evaluating instance - string data based on "contentEncoding" and/or "contentMediaType" are at - risk of evaluating data in an unsafe way based on misleading information. - Applications can mitigate this risk by only performing such processing - when a relationship between the schema and instance is established - (e.g., they share the same authority).

    -

    - Processing a media type or encoding is subject to the security considerations - of that media type or encoding. For example, the security considerations - of RFC 4329 Scripting Media Types [RFC4329] apply when - processing JavaScript or ECMAScript encoded within a JSON string.

    -
    -
    -
    -

    -11. References -

    -
    -

    -11.1. Normative References -

    -
    -
    [RFC2119]
    -
    -Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/info/rfc2119>.
    -
    -
    [RFC1123]
    -
    -Braden, R., Ed., "Requirements for Internet Hosts - Application and Support", STD 3, RFC 1123, DOI 10.17487/RFC1123, , <https://www.rfc-editor.org/info/rfc1123>.
    -
    -
    [RFC2045]
    -
    -Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies", RFC 2045, DOI 10.17487/RFC2045, , <https://www.rfc-editor.org/info/rfc2045>.
    -
    -
    [RFC2046]
    -
    -Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types", RFC 2046, DOI 10.17487/RFC2046, , <https://www.rfc-editor.org/info/rfc2046>.
    -
    -
    [RFC2673]
    -
    -Crawford, M., "Binary Labels in the Domain Name System", RFC 2673, DOI 10.17487/RFC2673, , <https://www.rfc-editor.org/info/rfc2673>.
    -
    -
    [RFC3339]
    -
    -Klyne, G. and C. Newman, "Date and Time on the Internet: Timestamps", RFC 3339, DOI 10.17487/RFC3339, , <https://www.rfc-editor.org/info/rfc3339>.
    -
    -
    [RFC3986]
    -
    -Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, DOI 10.17487/RFC3986, , <https://www.rfc-editor.org/info/rfc3986>.
    -
    -
    [RFC3987]
    -
    -Duerst, M. and M. Suignard, "Internationalized Resource Identifiers (IRIs)", RFC 3987, DOI 10.17487/RFC3987, , <https://www.rfc-editor.org/info/rfc3987>.
    -
    -
    [RFC4122]
    -
    -Leach, P., Mealling, M., and R. Salz, "A Universally Unique IDentifier (UUID) URN Namespace", RFC 4122, DOI 10.17487/RFC4122, , <https://www.rfc-editor.org/info/rfc4122>.
    -
    -
    [RFC4291]
    -
    -Hinden, R. and S. Deering, "IP Version 6 Addressing Architecture", RFC 4291, DOI 10.17487/RFC4291, , <https://www.rfc-editor.org/info/rfc4291>.
    -
    -
    [RFC4648]
    -
    -Josefsson, S., "The Base16, Base32, and Base64 Data Encodings", RFC 4648, DOI 10.17487/RFC4648, , <https://www.rfc-editor.org/info/rfc4648>.
    -
    -
    [RFC5321]
    -
    -Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, DOI 10.17487/RFC5321, , <https://www.rfc-editor.org/info/rfc5321>.
    -
    -
    [RFC5890]
    -
    -Klensin, J., "Internationalized Domain Names for Applications (IDNA): Definitions and Document Framework", RFC 5890, DOI 10.17487/RFC5890, , <https://www.rfc-editor.org/info/rfc5890>.
    -
    -
    [RFC5891]
    -
    -Klensin, J., "Internationalized Domain Names in Applications (IDNA): Protocol", RFC 5891, DOI 10.17487/RFC5891, , <https://www.rfc-editor.org/info/rfc5891>.
    -
    -
    [RFC6570]
    -
    -Gregorio, J., Fielding, R., Hadley, M., Nottingham, M., and D. Orchard, "URI Template", RFC 6570, DOI 10.17487/RFC6570, , <https://www.rfc-editor.org/info/rfc6570>.
    -
    -
    [RFC6531]
    -
    -Yao, J. and W. Mao, "SMTP Extension for Internationalized Email", RFC 6531, DOI 10.17487/RFC6531, , <https://www.rfc-editor.org/info/rfc6531>.
    -
    -
    [RFC6901]
    -
    -Bryan, P., Ed., Zyp, K., and M. Nottingham, Ed., "JavaScript Object Notation (JSON) Pointer", RFC 6901, DOI 10.17487/RFC6901, , <https://www.rfc-editor.org/info/rfc6901>.
    -
    -
    [RFC8259]
    -
    -Bray, T., Ed., "The JavaScript Object Notation (JSON) Data Interchange Format", STD 90, RFC 8259, DOI 10.17487/RFC8259, , <https://www.rfc-editor.org/info/rfc8259>.
    -
    -
    [ecma262]
    -
    -"ECMA-262, 11th edition specification", , <https://www.ecma-international.org/ecma-262/11.0>.
    -
    -
    [relative-json-pointer]
    -
    -Luff, G., Andrews, H., and B. Hutton, Ed., "Relative JSON Pointers", Work in Progress, Internet-Draft, draft-handrews-relative-json-pointer-01, , <https://datatracker.ietf.org/doc/html/draft-handrews-relative-json-pointer-01>.
    -
    -
    [json-schema]
    -
    -Wright, A., Andrews, H., Hutton, B., and G. Dennis, "JSON Schema: A Media Type for Describing JSON Documents", Work in Progress, Internet-Draft, draft-bhutton-json-schema-01, , <https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-01>.
    -
    -
    -
    -
    -

    -11.2. Informative References -

    -
    -
    [RFC4329]
    -
    -Hoehrmann, B., "Scripting Media Types", RFC 4329, DOI 10.17487/RFC4329, , <https://www.rfc-editor.org/info/rfc4329>.
    -
    -
    -
    -
    -
    -

    -Appendix A. Keywords Moved from Validation to Core -

    -

    - Several keywords have been moved from this document into the - Core Specification [json-schema] as of this draft, in some - cases with re-naming or other changes. This affects the following former - validation keywords:

    -
    -
    "definitions"
    -
    - Renamed to "$defs" to match "$ref" and be shorter to type. - Schema vocabulary authors SHOULD NOT define a "definitions" keyword - with different behavior in order to avoid invalidating schemas that - still use the older name. While "definitions" is absent in the - single-vocabulary meta-schemas referenced by this document, it - remains present in the default meta-schema, and implementations - SHOULD assume that "$defs" and "definitions" have the same - behavior when that meta-schema is used. -
    -
    -
    "allOf", "anyOf", "oneOf", "not", "if", "then", "else", "items", "additionalItems", "contains", "propertyNames", "properties", "patternProperties", "additionalProperties"
    -
    - All of these keywords apply subschemas to the instance and combine - their results, without asserting any conditions of their own. - Without assertion keywords, these applicators can only cause assertion - failures by using the false boolean schema, or by inverting the result - of the true boolean schema (or equivalent schema objects). - For this reason, they are better defined as a generic mechanism on which - validation, hyper-schema, and extension vocabularies can all be based. -
    -
    -
    "dependencies"
    -
    - This keyword had two different modes of behavior, which made it - relatively challenging to implement and reason about. - The schema form has been moved to Core and renamed to - "dependentSchemas", as part of the applicator vocabulary. - It is analogous to "properties", except that instead of applying - its subschema to the property value, it applies it to the object - containing the property. - The property name array form is retained here and renamed to - "dependentRequired", as it is an assertion which is a shortcut - for the conditional use of the "required" assertion keyword. -
    -
    -
    -
    -
    -

    -Appendix B. Acknowledgments -

    -

    - Thanks to - Gary Court, - Francis Galiegue, - Kris Zyp, - and Geraint Luff - for their work on the initial drafts of JSON Schema.

    -

    - Thanks to - Jason Desrosiers, - Daniel Perrett, - Erik Wilde, - Evgeny Poberezkin, - Brad Bowman, - Gowry Sankar, - Donald Pipowitch, - Dave Finlay, - Denis Laxalde, - Phil Sturgeon, - Shawn Silverman, - and Karen Etheridge - for their submissions and patches to the document.

    -
    -
    -

    -Appendix C. ChangeLog -

    -

    - This section to be removed before leaving Internet-Draft status.

    -
    -
    draft-bhutton-json-schema-validation-00
    -
    -
      -
    • Correct email format RFC reference to 5321 instead of 5322 -
    • -
    • Clarified the set and meaning of "contentEncoding" values -
    • -
    • Reference ECMA-262, 11th edition for regular expression support -
    • -
    • Split "format" into an annotation only vocabulary and an assertion vocabulary -
    • -
    • Clarify "deprecated" when applicable to arrays -
    • -
    -
    -
    -
    draft-handrews-json-schema-validation-02
    -
    -
      -
    • Grouped keywords into formal vocabularies -
    • -
    • Update "format" implementation requirements in terms of vocabularies -
    • -
    • By default, "format" MUST NOT be validated, although validation can be enabled -
    • -
    • A vocabulary declaration can be used to require "format" validation -
    • -
    • Moved "definitions" to the core spec as "$defs" -
    • -
    • Moved applicator keywords to the core spec -
    • -
    • Renamed the array form of "dependencies" to "dependentRequired", moved the schema form to the core spec -
    • -
    • Specified all "content*" keywords as annotations, not assertions -
    • -
    • Added "contentSchema" to allow applying a schema to a string-encoded document -
    • -
    • Also allow RFC 4648 encodings in "contentEncoding" -
    • -
    • Added "minContains" and "maxContains" -
    • -
    • Update RFC reference for "hostname" and "idn-hostname" -
    • -
    • Add "uuid" and "duration" formats -
    • -
    -
    -
    -
    draft-handrews-json-schema-validation-01
    -
    -
      -
    • This draft is purely a clarification with no functional changes -
    • -
    • Provided the general principle behind ignoring annotations under "not" and similar cases -
    • -
    • Clarified "if"/"then"/"else" validation interactions -
    • -
    • Clarified "if"/"then"/"else" behavior for annotation -
    • -
    • Minor formatting and cross-referencing improvements -
    • -
    -
    -
    -
    draft-handrews-json-schema-validation-00
    -
    -
      -
    • Added "if"/"then"/"else" -
    • -
    • Classify keywords as assertions or annotations per the core spec -
    • -
    • Warn of possibly removing "dependencies" in the future -
    • -
    • Grouped validation keywords into sub-sections for readability -
    • -
    • Moved "readOnly" from hyper-schema to validation meta-data -
    • -
    • Added "writeOnly" -
    • -
    • Added string-encoded media section, with former hyper-schema "media" keywords -
    • -
    • Restored "regex" format (removal was unintentional) -
    • -
    • Added "date" and "time" formats, and reserved additional RFC 3339 format names -
    • -
    • I18N formats: "iri", "iri-reference", "idn-hostname", "idn-email" -
    • -
    • Clarify that "json-pointer" format means string encoding, not URI fragment -
    • -
    • Fixed typo that inverted the meaning of "minimum" and "exclusiveMinimum" -
    • -
    • Move format syntax references into Normative References -
    • -
    • JSON is a normative requirement -
    • -
    -
    -
    -
    draft-wright-json-schema-validation-01
    -
    -
      -
    • Standardized on hyphenated format names with full words ("uriref" becomes "uri-reference") -
    • -
    • Add the formats "uri-template" and "json-pointer" -
    • -
    • Changed "exclusiveMaximum"/"exclusiveMinimum" from boolean modifiers of "maximum"/"minimum" to independent numeric fields. -
    • -
    • Split the additionalItems/items into two sections -
    • -
    • Reworked properties/patternProperties/additionalProperties definition -
    • -
    • Added "examples" keyword -
    • -
    • Added "contains" keyword -
    • -
    • Allow empty "required" and "dependencies" arrays -
    • -
    • Fixed "type" reference to primitive types -
    • -
    • Added "const" keyword -
    • -
    • Added "propertyNames" keyword -
    • -
    -
    -
    -
    draft-wright-json-schema-validation-00
    -
    -
      -
    • Added additional security considerations -
    • -
    • Removed reference to "latest version" meta-schema, use numbered version instead -
    • -
    • Rephrased many keyword definitions for brevity -
    • -
    • Added "uriref" format that also allows relative URI references -
    • -
    -
    -
    -
    draft-fge-json-schema-validation-00
    -
    -
      -
    • Initial draft. -
    • -
    • Salvaged from draft v3. -
    • -
    • Redefine the "required" keyword. -
    • -
    • Remove "extends", "disallow" -
    • -
    • Add "anyOf", "allOf", "oneOf", "not", "definitions", "minProperties", - "maxProperties". -
    • -
    • "dependencies" member values can no longer be single strings; at - least one element is required in a property dependency array. -
    • -
    • Rename "divisibleBy" to "multipleOf". -
    • -
    • "type" arrays can no longer have schemas; remove "any" as a possible - value. -
    • -
    • Rework the "format" section; make support optional. -
    • -
    • "format": remove attributes "phone", "style", "color"; rename - "ip-address" to "ipv4"; add references for all attributes. -
    • -
    • Provide algorithms to calculate schema(s) for array/object - instances. -
    • -
    • Add interoperability considerations. -
    • -
    -
    -
    -
    -
    -
    -
    -

    -Authors' Addresses -

    -
    -
    Austin Wright (editor)
    - -
    -
    -
    Henry Andrews (editor)
    - -
    -
    -
    Ben Hutton (editor)
    - - -
    -
    -
    - - - diff --git a/work-in-progress/index.md b/work-in-progress/index.md index 81f5f427..ba28d738 100644 --- a/work-in-progress/index.md +++ b/work-in-progress/index.md @@ -7,44 +7,6 @@ permalink: /work-in-progress * TOC {:toc} -## Right now - -We're working towards JSON Schema 2022-NN. - -Additionally, we're working on draft 2020-12-patch-1 ([Associated GitHub milestone](https://github.com/json-schema-org/json-schema-spec/milestone/9)) - -## Release latest news - -On 2022-04-29, we published Release Candiate 0 for this release. - -These documents will be given the IETF identifiers `draft-bhutton-*-01`. - -## RC-0 preview - -You can find RC-0 preview of the following documents: -- [JSON Schema Core specification](/draft/preview/2020-12-p1-rc-0/jsonschema-core.html) -- [JSON Schema Validation specification](/draft/preview/2020-12-p1-rc-0/jsonschema-validation.html) - -There are no changes to the Relative JSON Pointer specification. - -View the git diff on GitHub for: -- [draft 2020-12 release to 2020-12-patch-01-rc0](https://github.com/json-schema-org/json-schema-spec/compare/2020-12...draft-bhutton--01-rc0) (git tag `draft-bhutton--01-rc0) -- [draft 2020-12 release to master](https://github.com/json-schema-org/json-schema-spec/compare/2020-12...master) (This may include changes based on Release Candidate feedback) - -This "work in progress" page will be updated as the release progress for 2020-12-patch-1 progresses. - -## How to provide feedback for RC-0 -Note, feedback for RC-0 closes on 2022-05-14. - -Please make use of the two week feedback window for RC-0 by either: -- Filing issues on the [specification repository](https://github.com/json-schema-org/json-schema-spec/issues), making it clear the issue relates to 2020-12-patch-1-RC-0 -- Discuss in the [#specification channel on our Slack server](https://json-schema.slack.com/archives/CT7FF623C) - You will need to join if you haven't already - -**Please note, only feedback relating specifically to the changes found in the above diff are useful. This release is not making functional changes.** - -The previous `draft 2020-12` specification documents will become obsolete, as did draft-07 specification documents when they were patched. - -If you have suggestions for changes to the specification in general, we invite you to open a [Discussion on our GitHub organization](https://github.com/orgs/json-schema-org/discussions) and/or chat with us in the #general or #specificaiton channels on our [Slack server](/slack). - +We're working towards draft 2022-NN. See the [GitHub repository](https://github.com/json-schema-org/json-schema-spec) for ongoing spec work. From 656fe08a2a15b342198974a82c6c8dea02f14b4a Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Tue, 14 Jun 2022 10:44:53 +0100 Subject: [PATCH 095/206] Update specification page links to IETF specification documents for 2020-12 to patched version (bhutton-*-01) where applicable --- specification.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specification.md b/specification.md index ab8e91c2..e70419a9 100644 --- a/specification.md +++ b/specification.md @@ -23,8 +23,8 @@ Validation in any significant way. | [Relative JSON Pointers](draft/2020-12/relative-json-pointer.html) | extends the JSON Pointer syntax for relative pointers | They are also available on the IETF main site: -* [draft-bhutton-json-schema-00 (core)](https://tools.ietf.org/html/draft-bhutton-json-schema-00) -* [draft-bhutton-json-schema-validation-00](https://tools.ietf.org/html/draft-bhutton-json-schema-validation-00) +* [draft-bhutton-json-schema-01 (core)](https://tools.ietf.org/html/draft-bhutton-json-schema-01) +* [draft-bhutton-json-schema-validation-01](https://tools.ietf.org/html/draft-bhutton-json-schema-validation-01) * [draft-bhutton-relative-json-pointer-00](https://tools.ietf.org/html/draft-bhutton-relative-json-pointer-00) Meta-schemas From d7ff4258a3b18585f783ed83d63400d5b677db4b Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Thu, 16 Jun 2022 18:01:13 +0100 Subject: [PATCH 096/206] Update specification links page with links to new 2020-12 patch documents --- specification-links.md | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/specification-links.md b/specification-links.md index 2bf9b018..155bfcca 100644 --- a/specification-links.md +++ b/specification-links.md @@ -249,13 +249,13 @@ For links to the somewhat more readably formatted versions on this web site, and draft‑bhutton‑relative‑json‑pointer‑00
    - + 2020‑12 - + Draft 2020-12 - + Milestone: draft-08-patch-1 @@ -264,6 +264,18 @@ For links to the somewhat more readably formatted versions on this web site, and + + + + + draft‑bhutton‑json‑schema‑01 +
    + + draft‑bhutton‑json‑schema‑validation‑01 +
    +
    + + (TBD) @@ -272,11 +284,11 @@ For links to the somewhat more readably formatted versions on this web site, and (TBD) - Draft 2021-NN + 2022-NN Milestone: - Draft 2021-NN + 2022-NN @@ -288,8 +300,8 @@ For links to the somewhat more readably formatted versions on this web site, and ### 2020-12 - Specifications - - Core: [draft-bhutton-json-schema-00](https://tools.ietf.org/html/draft-bhutton-json-schema-00) ([changes](https://tools.ietf.org/html/draft-bhutton-json-schema-00#appendix-G)) - - Validation: [draft-bhutton-json-schema-validation-00](https://tools.ietf.org/html/draft-bhutton-json-schema-validation-00) ([changes](https://tools.ietf.org/html/draft-bhutton-json-schema-validation-00#appendix-C)) + - Core: [draft-bhutton-json-schema-01](https://tools.ietf.org/html/draft-bhutton-json-schema-01) ([changes](https://tools.ietf.org/html/draft-bhutton-json-schema-01#appendix-G)) + - Validation: [draft-bhutton-json-schema-validation-01](https://tools.ietf.org/html/draft-bhutton-json-schema-validation-01) ([changes](https://tools.ietf.org/html/draft-bhutton-json-schema-validation-01#appendix-C)) - Relative JSON Pointer: [draft-bhutton-relative-json-pointer-00](https://tools.ietf.org/html/draft-bhutton-relative-json-pointer-00) ([changes](https://tools.ietf.org/html/draft-bhutton-relative-json-pointer-00#appendix-A)) - General use meta-schemas - [JSON Schema meta-schema](draft/2020-12/schema) @@ -309,6 +321,13 @@ For links to the somewhat more readably formatted versions on this web site, and - Output examples - [JSON Schema verbose output example](draft/2020-12/output/verbose-example) +#### Obsolete Draft 2020-12 Documents + +_These were updated without changing functionality or meta-schemas due to a few errors and unclear sections._ + +- Core: [draft-bhutton-json-schema-00](https://tools.ietf.org/html/draft-bhutton-json-schema-00) ([changes](https://tools.ietf.org/html/draft-bhutton-json-schema-00#appendix-G)) +- Validation: [draft-bhutton-json-schema-validation-00](https://tools.ietf.org/html/draft-bhutton-json-schema-validation-00) ([changes](https://tools.ietf.org/html/draft-bhutton-json-schema-validation-00#appendix-C)) + ### Draft 2019-09 (formerly known as Draft 8) _**NOTE:** All meta-schema URIs now use `https://`. While currently also available over plain HTTP due to the limitations of GitHub pages and the need to keep prior drafts available over HTTP, only the HTTPS URIs should be used._ From 9756e574eaaac246ac514456f931847d3248d920 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Thu, 16 Jun 2022 18:12:08 +0100 Subject: [PATCH 097/206] Update spec files and submodules for 2020-12 patch --- .gitmodules | 3 + _includes/draft/2020-12 | 2 +- draft/2020-12/json-schema-core.html | 5822 +++++++++++++++++++++ draft/2020-12/json-schema-validation.html | 3185 +++++++++++ 4 files changed, 9011 insertions(+), 1 deletion(-) create mode 100644 draft/2020-12/json-schema-core.html create mode 100644 draft/2020-12/json-schema-validation.html diff --git a/.gitmodules b/.gitmodules index ec9c71cd..5b323ddb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,15 +10,18 @@ [submodule "_includes/draft-03"] path = _includes/draft-03 url = https://github.com/json-schema-org/json-schema-spec.git + branch = draft-03 [submodule "_includes/draft-04"] path = _includes/draft-04 url = https://github.com/json-schema-org/json-schema-spec.git + branch = draft-04 [submodule "_includes/draft-05"] path = _includes/draft-05 url = https://github.com/json-schema-org/json-schema-spec.git [submodule "_includes/draft-06"] path = _includes/draft-06 url = https://github.com/json-schema-org/json-schema-spec.git + branch = draft-06 [submodule "_includes/draft-07"] path = _includes/draft-07 url = https://github.com/json-schema-org/json-schema-spec.git diff --git a/_includes/draft/2020-12 b/_includes/draft/2020-12 index 117c05e5..769daad7 160000 --- a/_includes/draft/2020-12 +++ b/_includes/draft/2020-12 @@ -1 +1 @@ -Subproject commit 117c05e55ae0a798a10907f61348c81318971f9d +Subproject commit 769daad75a9553562333a8937a187741cb708c72 diff --git a/draft/2020-12/json-schema-core.html b/draft/2020-12/json-schema-core.html new file mode 100644 index 00000000..e8bd04bf --- /dev/null +++ b/draft/2020-12/json-schema-core.html @@ -0,0 +1,5822 @@ + + + + + + +JSON Schema: A Media Type for Describing JSON Documents + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Internet-DraftJSON SchemaJune 2022
    Wright, et al.Expires 18 December 2022[Page]
    +
    +
    +
    +
    Workgroup:
    +
    Internet Engineering Task Force
    +
    Internet-Draft:
    +
    draft-bhutton-json-schema-01
    +
    Published:
    +
    + +
    +
    Intended Status:
    +
    Informational
    +
    Expires:
    +
    +
    Authors:
    +
    +
    +
    A. Wright, Ed. +
    +
    +
    +
    H. Andrews, Ed. +
    +
    +
    +
    B. Hutton, Ed. +
    +
    Postman
    +
    +
    +
    G. Dennis
    +
    +
    +
    +
    +

    JSON Schema: A Media Type for Describing JSON Documents

    +
    +

    Abstract

    +

    + JSON Schema defines the media type "application/schema+json", a JSON-based format + for describing the structure of JSON data. + JSON Schema asserts what a JSON document must look like, + ways to extract information from it, + and how to interact with it. + The "application/schema-instance+json" media type provides additional + feature-rich integration with "application/schema+json" beyond what can be offered + for "application/json" documents.

    +
    +
    +

    +Note to Readers +

    +

    + The issues list for this draft can be found at + https://github.com/json-schema-org/json-schema-spec/issues.

    +

    + For additional information, see https://json-schema.org/.

    +

    + To provide feedback, use this issue tracker, the communication methods listed on the + homepage, or email the document editors.

    +
    +
    +
    +

    +Status of This Memo +

    +

    + This Internet-Draft is submitted in full conformance with the + provisions of BCP 78 and BCP 79.

    +

    + Internet-Drafts are working documents of the Internet Engineering Task + Force (IETF). Note that other groups may also distribute working + documents as Internet-Drafts. The list of current Internet-Drafts is + at https://datatracker.ietf.org/drafts/current/.

    +

    + Internet-Drafts are draft documents valid for a maximum of six months + and may be updated, replaced, or obsoleted by other documents at any + time. It is inappropriate to use Internet-Drafts as reference + material or to cite them other than as "work in progress."

    +

    + This Internet-Draft will expire on 18 December 2022.

    +
    +
    + +
    +
    +

    +Table of Contents +

    + +
    +
    +
    +

    +1. Introduction +

    +

    + JSON Schema is a JSON media type for defining the structure of JSON data. JSON Schema + is intended to define validation, documentation, hyperlink navigation, and interaction + control of JSON data.

    +

    + This specification defines JSON Schema core terminology and mechanisms, including + pointing to another JSON Schema by reference, + dereferencing a JSON Schema reference, + specifying the dialect being used, + specifying a dialect's vocabulary requirements, + and defining the expected output.

    +

    + Other specifications define the vocabularies that perform assertions about validation, + linking, annotation, navigation, and interaction.

    +
    +
    +

    +2. Conventions and Terminology +

    +

    + + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", + "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be + interpreted as described in RFC 2119 [RFC2119].

    +

    + The terms "JSON", "JSON text", "JSON value", "member", "element", "object", "array", + "number", "string", "boolean", "true", "false", and "null" in this document are to + be interpreted as defined in RFC 8259 [RFC8259].

    +
    +
    +

    +3. Overview +

    +

    + This document proposes a new media type "application/schema+json" to identify a JSON + Schema for describing JSON data. + It also proposes a further optional media type, "application/schema-instance+json", + to provide additional integration features. + JSON Schemas are themselves JSON documents. + This, and related specifications, define keywords allowing authors to describe JSON + data in several ways.

    +

    + JSON Schema uses keywords to assert constraints on JSON instances or annotate those + instances with additional information. Additional keywords are used to apply + assertions and annotations to more complex JSON data structures, or based on + some sort of condition.

    +

    + To facilitate re-use, keywords can be organized into vocabularies. A vocabulary + consists of a list of keywords, together with their syntax and semantics. + A dialect is defined as a set of vocabularies and their required support + identified in a meta-schema.

    +

    + JSON Schema can be extended either by defining additional vocabularies, + or less formally by defining additional keywords outside of any vocabulary. + Unrecognized individual keywords simply have their values collected as annotations, + while the behavior with respect to an unrecognized vocabulary can be controlled + when declaring which vocabularies are in use.

    +

    + This document defines a core vocabulary that MUST be supported by any + implementation, and cannot be disabled. Its keywords are each prefixed + with a "$" character to emphasize their required nature. This vocabulary + is essential to the functioning of the "application/schema+json" media + type, and is used to bootstrap the loading of other vocabularies.

    +

    + Additionally, this document defines a RECOMMENDED vocabulary of keywords + for applying subschemas conditionally, and for applying subschemas to + the contents of objects and arrays. Either this vocabulary or one very + much like it is required to write schemas for non-trivial JSON instances, + whether those schemas are intended for assertion validation, annotation, + or both. While not part of the required core vocabulary, for maximum + interoperability this additional vocabulary is included in this document + and its use is strongly encouraged.

    +

    + Further vocabularies for purposes such as structural validation or + hypermedia annotation are defined in other documents. These other + documents each define a dialect collecting the standard sets of + vocabularies needed to write schemas for that document's purpose.

    +
    +
    +

    +4. Definitions +

    +
    +

    +4.1. JSON Document +

    +

    + A JSON document is an information resource (series of octets) described by the + application/json media type.

    +

    + In JSON Schema, the terms "JSON document", "JSON text", and "JSON value" are + interchangeable because of the data model it defines.

    +

    + JSON Schema is only defined over JSON documents. However, any document or memory + structure that can be parsed into or processed according to the JSON Schema data + model can be interpreted against a JSON Schema, including media types like + CBOR [RFC7049].

    +
    +
    +

    +4.2. Instance +

    +

    + A JSON document to which a schema is applied is known as an "instance".

    +

    + JSON Schema is defined over "application/json" or compatible documents, + including media types with the "+json" structured syntax suffix.

    +

    + Among these, this specification defines the "application/schema-instance+json" + media type which defines handling for fragments in the URI.

    +
    +

    +4.2.1. Instance Data Model +

    +

    + JSON Schema interprets documents according to a data model. A JSON value + interpreted according to this data model is called an "instance".

    +

    + An instance has one of six primitive types, and a range of possible values + depending on the type:

    +
    +
    null:
    +
    A JSON "null" value +
    +
    +
    boolean:
    +
    A "true" or "false" value, from the JSON "true" or "false" value +
    +
    +
    object:
    +
    An unordered set of properties mapping a string to an instance, from the JSON "object" value +
    +
    +
    array:
    +
    An ordered list of instances, from the JSON "array" value +
    +
    +
    number:
    +
    An arbitrary-precision, base-10 decimal number value, from the JSON "number" value +
    +
    +
    string:
    +
    A string of Unicode code points, from the JSON "string" value +
    +
    +
    +

    + Whitespace and formatting concerns, including different lexical + representations of numbers that are equal within the data model, are thus + outside the scope of JSON Schema. JSON Schema + vocabularies (Section 8.1) that wish + to work with such differences in lexical representations SHOULD define + keywords to precisely interpret formatted strings within the data model + rather than relying on having the original JSON representation Unicode + characters available.

    +

    + Since an object cannot have two properties with the same key, behavior for a + JSON document that tries to define two properties with + the same key in a single object is undefined.

    +

    + Note that JSON Schema vocabularies are free to define their own extended + type system. This should not be confused with the core data model types + defined here. As an example, "integer" is a reasonable type for a + vocabulary to define as a value for a keyword, but the data model + makes no distinction between integers and other numbers.

    +
    +
    +

    +4.2.2. Instance Equality +

    +

    + Two JSON instances are said to be equal if and only if they are of the same type + and have the same value according to the data model. Specifically, this means:

    +
      +
    • both are null; or +
    • +
    • both are true; or +
    • +
    • both are false; or +
    • +
    • both are strings, and are the same codepoint-for-codepoint; or +
    • +
    • both are numbers, and have the same mathematical value; or +
    • +
    • both are arrays, and have an equal value item-for-item; or +
    • +
    • both are objects, and each property in one has exactly one property with + a key equal to the other's, and that other property has an equal + value. +
    • +
    +

    + Implied in this definition is that arrays must be the same length, + objects must have the same number of members, + properties in objects are unordered, + there is no way to define multiple properties with the same key, + and mere formatting differences (indentation, placement of commas, trailing + zeros) are insignificant.

    +
    +
    +

    +4.2.3. Non-JSON Instances +

    +

    + It is possible to use JSON Schema with a superset of the JSON Schema data model, + where an instance may be outside any of the six JSON data types.

    +

    + In this case, annotations still apply; but most validation keywords will not be useful, + as they will always pass or always fail.

    +

    + A custom vocabulary may define support for a superset of the core data model. + The schema itself may only be expressible in this superset; + for example, to make use of the "const" keyword.

    +
    +
    +
    +
    +

    +4.3. JSON Schema Documents +

    +

    + A JSON Schema document, or simply a schema, is a JSON document used to describe + an instance. + A schema can itself be interpreted as an instance, but SHOULD always be given + the media type "application/schema+json" rather than + "application/schema-instance+json". The "application/schema+json" media + type is defined to offer a superset of the + fragment identifier syntax and semantics provided by + "application/schema-instance+json".

    +

    + A JSON Schema MUST be an object or a boolean.

    +
    +

    +4.3.1. JSON Schema Objects and Keywords +

    +

    + Object properties that are applied to the instance are called keywords, + or schema keywords. Broadly speaking, keywords fall into one + of five categories:

    +
    +
    identifiers:
    +
    + control schema identification through setting a URI + for the schema and/or changing how the base URI is determined +
    +
    +
    assertions:
    +
    + produce a boolean result when applied to an instance +
    +
    +
    annotations:
    +
    + attach information to an instance for application use +
    +
    +
    applicators:
    +
    + apply one or more subschemas to a particular location + in the instance, and combine or modify their results +
    +
    +
    reserved locations:
    +
    + do not directly affect results, but reserve a place + for a specific purpose to ensure interoperability +
    +
    +
    +

    + Keywords may fall into multiple categories, although applicators + SHOULD only produce assertion results based on their subschemas' + results. They should not define additional constraints independent + of their subschemas.

    +

    + Keywords which are properties within the same schema object are referred to as adjacent keywords.

    +

    + Extension keywords, meaning those defined outside of this document + and its companions, are free to define other behaviors as well.

    +

    + A JSON Schema MAY contain properties which are not schema keywords. + Unknown keywords SHOULD be treated as annotations, where the value + of the keyword is the value of the annotation.

    +

    + An empty schema is a JSON Schema with no properties, or only unknown + properties.

    +
    +
    +

    +4.3.2. Boolean JSON Schemas +

    +

    + The boolean schema values "true" and "false" are trivial schemas that + always produce themselves as assertion results, regardless of the + instance value. They never produce annotation results.

    +

    + These boolean schemas exist to clarify schema author intent and + facilitate schema processing optimizations. They behave identically + to the following schema objects (where "not" is part of the + subschema application vocabulary defined in this document).

    +
    +
    true:
    +
    + Always passes validation, as if the empty schema {} +
    +
    +
    false:
    +
    + Always fails validation, as if the schema { "not": {} } +
    +
    +
    +

    + While the empty schema object is unambiguous, there are many + possible equivalents to the "false" schema. Using the boolean + values ensures that the intent is clear to both human readers + and implementations.

    +
    +
    +

    +4.3.3. Schema Vocabularies +

    +

    + A schema vocabulary, or simply a vocabulary, is a set of keywords, + their syntax, and their semantics. A vocabulary is generally organized + around a particular purpose. Different uses of JSON Schema, such + as validation, hypermedia, or user interface generation, will + involve different sets of vocabularies.

    +

    + Vocabularies are the primary unit of re-use in JSON Schema, as schema + authors can indicate what vocabularies are required or optional in + order to process the schema. Since vocabularies are identified by URIs + in the meta-schema, generic implementations can load extensions to support + previously unknown vocabularies. While keywords can be supported outside + of any vocabulary, there is no analogous mechanism to indicate individual + keyword usage.

    +

    + A schema vocabulary can be defined by anything from an informal description + to a standards proposal, depending on the audience and interoperability + expectations. In particular, in order to facilitate vocabulary use within + non-public organizations, a vocabulary specification need not be published + outside of its scope of use.

    +
    +
    +

    +4.3.4. Meta-Schemas +

    +

    + A schema that itself describes a schema is called a meta-schema. + Meta-schemas are used to validate JSON Schemas and specify which vocabularies + they are using.

    +

    + Typically, a meta-schema will specify a set of vocabularies, and validate + schemas that conform to the syntax of those vocabularies. However, meta-schemas + and vocabularies are separate in order to allow meta-schemas to validate + schema conformance more strictly or more loosely than the vocabularies' + specifications call for. Meta-schemas may also describe and validate + additional keywords that are not part of a formal vocabulary.

    +
    +
    +
    +

    +4.3.5. Root Schema and Subschemas and Resources +

    +

    + A JSON Schema resource is a schema which is + canonically [RFC6596] identified by an + absolute URI [RFC3986]. Schema resources MAY + also be identified by URIs, including URIs with fragments, + if the resulting secondary resource (as defined by + section 3.5 of RFC 3986 [RFC3986]) is identical + to the primary resource. This can occur with the empty fragment, + or when one schema resource is embedded in another. Any such URIs + with fragments are considered to be non-canonical.

    +

    + The root schema is the schema that comprises the entire JSON document + in question. The root schema is always a schema resource, where the + URI is determined as described in section + 9.1.1. + + Note that documents that embed schemas in another format will not + have a root schema resource in this sense. Exactly how such usages + fit with the JSON Schema document and resource concepts will be + clarified in a future draft. +

    +

    + Some keywords take schemas themselves, allowing JSON Schemas to be nested:

    +
    +
    +
    +{
    +    "title": "root",
    +    "items": {
    +        "title": "array item"
    +    }
    +}
    +
    +
    +
    +

    + In this example document, the schema titled "array item" is a subschema, + and the schema titled "root" is the root schema.

    +

    + As with the root schema, a subschema is either an object or a boolean.

    +

    + As discussed in section + 8.2.1, a JSON Schema document + can contain multiple JSON Schema resources. When used without qualification, + the term "root schema" refers to the document's root schema. In some + cases, resource root schemas are discussed. A resource's root schema + is its top-level schema object, which would also be a document root schema + if the resource were to be extracted to a standalone JSON Schema document.

    +

    + Whether multiple schema resources are embedded or linked with a reference, + they are processed in the same way, with the same available behaviors.

    +
    +
    +
    +
    +
    +
    +
    +

    +5. Fragment Identifiers +

    +

    + In accordance with section 3.1 of RFC 6839 [RFC6839], + the syntax and semantics of fragment identifiers specified for + any +json media type SHOULD be as specified for "application/json". + (At publication of this document, there is no fragment identification + syntax defined for "application/json".)

    +

    + Additionally, the "application/schema+json" media type supports two + fragment identifier structures: plain names and JSON Pointers. + The "application/schema-instance+json" media type supports one + fragment identifier structure: JSON Pointers.

    +

    + The use of JSON Pointers as URI fragment identifiers is described in + RFC 6901 [RFC6901]. + For "application/schema+json", which supports two fragment identifier syntaxes, + fragment identifiers matching the JSON Pointer syntax, including the empty string, + MUST be interpreted as JSON Pointer fragment identifiers.

    +

    + Per the W3C's + best practices for fragment identifiers [W3C.WD-fragid-best-practices-20121025], + plain name fragment identifiers in "application/schema+json" are reserved for referencing + locally named schemas. All fragment identifiers that do + not match the JSON Pointer syntax MUST be interpreted as + plain name fragment identifiers.

    +

    + Defining and referencing a plain name fragment identifier within an + "application/schema+json" document are specified + in the "$anchor" keyword (Section 8.2.2) section.

    +

    +
    +
    +
    +

    +6. General Considerations +

    +
    +

    +6.1. Range of JSON Values +

    +

    + An instance may be any valid JSON value as defined by JSON [RFC8259]. + JSON Schema imposes no restrictions on type: JSON Schema can describe any JSON + value, including, for example, null.

    +
    +
    +
    +

    +6.2. Programming Language Independence +

    +

    + JSON Schema is programming language agnostic, and supports the full range of + values described in the data model. + Be aware, however, that some languages and JSON parsers may not be able to + represent in memory the full range of values describable by JSON.

    +
    +
    +
    +
    +

    +6.3. Mathematical Integers +

    +

    + Some programming languages and parsers use different internal representations + for floating point numbers than they do for integers.

    +

    + For consistency, integer JSON numbers SHOULD NOT be encoded with a fractional + part.

    +
    +
    +
    +
    +

    +6.4. Regular Expressions +

    +

    + Keywords MAY use regular expressions to express constraints, or constrain + the instance value to be a regular expression. + These regular expressions SHOULD be valid according to the regular expression + dialect described in ECMA-262, section 21.2.1 [ecma262].

    +

    + Regular expressions SHOULD be built with the "u" flag (or equivalent) to provide + Unicode support, or processed in such a way which provides Unicode support as + defined by ECMA-262.

    +

    + Furthermore, given the high disparity in regular expression constructs support, + schema authors SHOULD limit themselves to the following regular expression + tokens:

    +
      +
    • individual Unicode characters, as defined by the JSON specification [RFC8259]; +
    • +
    • simple character classes ([abc]), range character classes ([a-z]); +
    • +
    • complemented character classes ([^abc], [^a-z]); +
    • +
    • simple quantifiers: "+" (one or more), "*" (zero or more), "?" (zero or + one), and their lazy versions ("+?", "*?", "??"); +
    • +
    • range quantifiers: "{x}" (exactly x occurrences), "{x,y}" (at least x, at + most y, occurrences), {x,} (x occurrences or more), and their lazy + versions; +
    • +
    • the beginning-of-input ("^") and end-of-input ("$") anchors; +
    • +
    • simple grouping ("(...)") and alternation ("|"). +
    • +
    +

    + Finally, implementations MUST NOT take regular expressions to be + anchored, neither at the beginning nor at the end. This means, for instance, + the pattern "es" matches "expression".

    +
    +
    +
    +
    +

    +6.5. Extending JSON Schema +

    +

    + Additional schema keywords and schema vocabularies MAY be defined + by any entity. Save for explicit agreement, schema authors SHALL NOT + expect these additional keywords and vocabularies to be supported by + implementations that do not explicitly document such support. + Implementations SHOULD treat keywords they do not support as annotations, + where the value of the keyword is the value of the annotation.

    +

    + Implementations MAY provide the ability to register or load handlers + for vocabularies that they do not support directly. The exact mechanism + for registering and implementing such handlers is implementation-dependent.

    +
    +
    +
    +
    +

    +7. Keyword Behaviors +

    +

    + JSON Schema keywords fall into several general behavior categories. + Assertions validate that an instance satisfies constraints, producing + a boolean result. Annotations attach information that applications + may use in any way they see fit. + Applicators apply subschemas to parts of the instance and combine + their results.

    +

    + Extension keywords SHOULD stay within these categories, keeping in mind + that annotations in particular are extremely flexible. Complex behavior + is usually better delegated to applications on the basis of annotation + data than implemented directly as schema keywords. However, extension + keywords MAY define other behaviors for specialized purposes.

    +

    + Evaluating an instance against a schema involves processing all of the + keywords in the schema against the appropriate locations within the instance. + Typically, applicator keywords are processed until a schema object with no + applicators (and therefore no subschemas) is reached. The appropriate + location in the instance is evaluated against the assertion and + annotation keywords in the schema object, and their results are gathered + into the parent schema according to the rules of the applicator.

    +

    + Evaluation of a parent schema object can complete once all of its + subschemas have been evaluated, although in some circumstances evaluation + may be short-circuited due to assertion results. When annotations are + being collected, some assertion result short-circuiting is not possible + due to the need to examine all subschemas for annotation collection, including + those that cannot further change the assertion result.

    +
    +
    +

    +7.1. Lexical Scope and Dynamic Scope +

    +

    + While most JSON Schema keywords can be evaluated on their own, + or at most need to take into account the values or results of + adjacent keywords in the same schema object, a few have more + complex behavior.

    +

    + The lexical scope of a keyword is determined by the nested JSON + data structure of objects and arrays. The largest such scope + is an entire schema document. The smallest scope is a single + schema object with no subschemas.

    +

    + Keywords MAY be defined with a partial value, such as a URI-reference, + which must be resolved against another value, such as another + URI-reference or a full URI, which is found through the lexical + structure of the JSON document. The "$id", "$ref", and + "$dynamicRef" core keywords, and the "base" JSON Hyper-Schema + keyword, are examples of this sort of behavior.

    +

    + Note that some keywords, such as "$schema", apply to the lexical + scope of the entire schema resource, and therefore MUST only + appear in a schema resource's root schema.

    +

    + Other keywords may take into account the dynamic scope that + exists during the evaluation of a schema, typically together + with an instance document. + The outermost dynamic scope is the schema object at + which processing begins, even if it is not a schema resource root. + The path from this root schema to any particular keyword (that + includes any "$ref" and "$dynamicRef" keywords that may have + been resolved) is considered the keyword's "validation path."

    +

    + Lexical and dynamic scopes align until a reference keyword + is encountered. While following the reference keyword moves processing + from one lexical scope into a different one, from the perspective + of dynamic scope, following a reference is no different from descending + into a subschema present as a value. A keyword on the far side of + that reference that resolves information through the dynamic scope + will consider the originating side of the reference to be their + dynamic parent, rather than examining the local lexically enclosing parent.

    +

    + The concept of dynamic scope is primarily used with "$dynamicRef" and + "$dynamicAnchor", and should be considered an advanced feature + and used with caution when defining additional keywords. It also appears + when reporting errors and collected annotations, as it may be possible + to revisit the same lexical scope repeatedly with different dynamic + scopes. In such cases, it is important to inform the user of the + dynamic path that produced the error or annotation.

    +
    +
    +
    +

    +7.2. Keyword Interactions +

    +

    + Keyword behavior MAY be defined in terms of the annotation results + of subschemas (Section 4.3.5) and/or adjacent keywords + (keywords within the same schema object) and their subschemas. + Such keywords MUST NOT result in a circular dependency. + Keywords MAY modify their behavior based on the presence or absence + of another keyword in the same + schema object (Section 4.3).

    +
    +
    +

    +7.3. Default Behaviors +

    +

    + A missing keyword MUST NOT produce a false assertion result, MUST + NOT produce annotation results, and MUST NOT cause any other schema + to be evaluated as part of its own behavioral definition. + However, given that missing keywords do not contribute annotations, + the lack of annotation results may indirectly change the behavior + of other keywords.

    +

    + In some cases, the missing keyword assertion behavior of a keyword is + identical to that produced by a certain value, and keyword definitions + SHOULD note such values where known. However, even if the value which + produces the default behavior would produce annotation results if + present, the default behavior still MUST NOT result in annotations.

    +

    + Because annotation collection can add significant cost in terms of both + computation and memory, implementations MAY opt out of this feature. + Keywords that are specified in terms of collected annotations SHOULD + describe reasonable alternate approaches when appropriate. + This approach is demonstrated by the + "items" and + "additionalProperties" keywords in this + document.

    +

    + Note that when no such alternate approach is possible for a keyword, + implementations that do not support annotation collections will not + be able to support those keywords or vocabularies that contain them.

    +
    +
    +

    +7.4. Identifiers +

    +

    + Identifiers define URIs for a schema, or affect how such URIs are + resolved in references (Section 8.2.3), or both. + The Core vocabulary defined in this document defines several + identifying keywords, most notably "$id".

    +

    + Canonical schema URIs MUST NOT change while processing an instance, but + keywords that affect URI-reference resolution MAY have behavior that + is only fully determined at runtime.

    +

    + While custom identifier keywords are possible, vocabulary designers should + take care not to disrupt the functioning of core keywords. For example, + the "$dynamicAnchor" keyword in this specification limits its URI resolution + effects to the matching "$dynamicRef" keyword, leaving the behavior + of "$ref" undisturbed.

    +
    +
    +
    +

    +7.5. Applicators +

    +

    + Applicators allow for building more complex schemas than can be accomplished + with a single schema object. Evaluation of an instance against a + schema document (Section 4.3) begins by applying + the root schema (Section 4.3.5) to the complete instance + document. From there, keywords known as applicators are used to determine + which additional schemas are applied. Such schemas may be applied in-place + to the current location, or to a child location.

    +

    + The schemas to be applied may be present as subschemas comprising all or + part of the keyword's value. Alternatively, an applicator may refer to + a schema elsewhere in the same schema document, or in a different one. + The mechanism for identifying such referenced schemas is defined by the + keyword.

    +

    + Applicator keywords also define how subschema or referenced schema + boolean assertion (Section 7.6) + results are modified and/or combined to produce the boolean result + of the applicator. Applicators may apply any boolean logic operation + to the assertion results of subschemas, but MUST NOT introduce new + assertion conditions of their own.

    +

    + Annotation (Section 7.7) results are + preserved along with the instance location and the location of + the schema keyword, so that applications can decide how to + interpret multiple values.

    +
    +
    +

    +7.5.1. Referenced and Referencing Schemas +

    +

    + As noted in Section 7.5, an applicator keyword may + refer to a schema to be applied, rather than including it as a + subschema in the applicator's value. In such situations, the + schema being applied is known as the referenced schema, while + the schema containing the applicator keyword is the referencing schema.

    +

    + While root schemas and subschemas are static concepts based on a + schema's position within a schema document, referenced and referencing + schemas are dynamic. Different pairs of schemas may find themselves + in various referenced and referencing arrangements during the evaluation + of an instance against a schema.

    +

    + For some by-reference applicators, such as + "$ref" (Section 8.2.3.1), the referenced schema can be determined + by static analysis of the schema document's lexical scope. Others, + such as "$dynamicRef" (with "$dynamicAnchor"), may make use of dynamic + scoping, and therefore only be resolvable in the process of evaluating + the schema with an instance.

    +
    +
    +
    +
    +
    +
    +

    +7.6. Assertions +

    +

    + JSON Schema can be used to assert constraints on a JSON document, which + either passes or fails the assertions. This approach can be used to validate + conformance with the constraints, or document what is needed to satisfy them.

    +

    + JSON Schema implementations produce a single boolean result when evaluating + an instance against schema assertions.

    +

    + An instance can only fail an assertion that is present in the schema.

    +
    +

    +7.6.1. Assertions and Instance Primitive Types +

    +

    + Most assertions only constrain values within a certain + primitive type. When the type of the instance is not of the type + targeted by the keyword, the instance is considered to conform + to the assertion.

    +

    + For example, the "maxLength" keyword from the companion + validation vocabulary [json-schema-validation]: + will only restrict certain strings + (that are too long) from being valid. If the instance is a number, + boolean, null, array, or object, then it is valid against this assertion.

    +

    + This behavior allows keywords to be used more easily with instances + that can be of multiple primitive types. The companion validation + vocabulary also includes a "type" keyword which can independently + restrict the instance to one or more primitive types. This allows + for a concise expression of use cases such as a function that might + return either a string of a certain length or a null value:

    +
    +
    +
    +{
    +    "type": ["string", "null"],
    +    "maxLength": 255
    +}
    +
    +
    +
    +

    + If "maxLength" also restricted the instance type to be a string, + then this would be substantially more cumbersome to express because + the example as written would not actually allow null values. + Each keyword is evaluated separately unless explicitly specified + otherwise, so if "maxLength" restricted the instance to strings, + then including "null" in "type" would not have any useful effect.

    +
    +
    +
    +
    +
    +

    +7.7. Annotations +

    +

    + JSON Schema can annotate an instance with information, whenever the instance + validates against the schema object containing the annotation, and all of its + parent schema objects. The information can be a simple value, or can be + calculated based on the instance contents.

    +

    + Annotations are attached to specific locations in an instance. + Since many subschemas can be applied to any single + location, applications may need to decide how to handle differing + annotation values being attached to the same instance location by + the same schema keyword in different schema objects.

    +

    + Unlike assertion results, annotation data can take a wide variety of forms, + which are provided to applications to use as they see fit. JSON Schema + implementations are not expected to make use of the collected information + on behalf of applications.

    +

    + Unless otherwise specified, the value of an annotation keyword + is the keyword's value. However, other behaviors are possible. + For example, JSON Hyper-Schema's [json-hyper-schema] + "links" keyword is a complex annotation that produces a value based + in part on the instance data.

    +

    + While "short-circuit" evaluation is possible for assertions, collecting + annotations requires examining all schemas that apply to an instance + location, even if they cannot change the overall assertion result. + The only exception is that subschemas of a schema object that has + failed validation MAY be skipped, as annotations are not retained + for failing schemas.

    +
    +

    +7.7.1. Collecting Annotations +

    +

    + Annotations are collected by keywords that explicitly define + annotation-collecting behavior. Note that boolean schemas cannot + produce annotations as they do not make use of keywords.

    +

    + A collected annotation MUST include the following information:

    +
      +
    • + The name of the keyword that produces the annotation +
    • +
    • + The instance location to which it is attached, as a JSON Pointer +
    • +
    • + The schema location path, indicating how reference keywords + such as "$ref" were followed to reach the absolute schema location. +
    • +
    • + The absolute schema location of the attaching keyword, as a URI. + This MAY be omitted if it is the same as the schema location path + from above. +
    • +
    • + The attached value(s) +
    • +
    +
    +
    +7.7.1.1. Distinguishing Among Multiple Values +
    +

    + Applications MAY make decisions on which of multiple annotation values + to use based on the schema location that contributed the value. + This is intended to allow flexible usage. Collecting the schema location + facilitates such usage.

    +

    + For example, consider this schema, which uses annotations and assertions from + the Validation specification [json-schema-validation]:

    +

    + Note that some lines are wrapped for clarity.

    +
    +
    +
    +{
    +    "title": "Feature list",
    +    "type": "array",
    +    "prefixItems": [
    +        {
    +            "title": "Feature A",
    +            "properties": {
    +                "enabled": {
    +                    "$ref": "#/$defs/enabledToggle",
    +                    "default": true
    +                }
    +            }
    +        },
    +        {
    +            "title": "Feature B",
    +            "properties": {
    +                "enabled": {
    +                    "description": "If set to null, Feature B
    +                                    inherits the enabled
    +                                    value from Feature A",
    +                    "$ref": "#/$defs/enabledToggle"
    +                }
    +            }
    +        }
    +    ],
    +    "$defs": {
    +        "enabledToggle": {
    +            "title": "Enabled",
    +            "description": "Whether the feature is enabled (true),
    +                            disabled (false), or under
    +                            automatic control (null)",
    +            "type": ["boolean", "null"],
    +            "default": null
    +        }
    +    }
    +}
    +
    +
    +
    +

    + In this example, both Feature A and Feature B make use of the re-usable + "enabledToggle" schema. That schema uses the "title", "description", + and "default" annotations. Therefore the application has to decide how + to handle the additional "default" value for Feature A, and the additional + "description" value for Feature B.

    +

    + The application programmer and the schema author need to agree on the + usage. For this example, let's assume that they agree that the most + specific "default" value will be used, and any additional, more generic + "default" values will be silently ignored. Let's also assume that they + agree that all "description" text is to be used, starting with the most + generic, and ending with the most specific. This requires the schema + author to write descriptions that work when combined in this way.

    +

    + The application can use the schema location path to determine which + values are which. The values in the feature's immediate "enabled" + property schema are more specific, while the values under the re-usable + schema that is referenced to with "$ref" are more generic. The schema + location path will show whether each value was found by crossing a + "$ref" or not.

    +

    + Feature A will therefore use a default value of true, while Feature B + will use the generic default value of null. Feature A will only + have the generic description from the "enabledToggle" schema, while + Feature B will use that description, and also append its locally + defined description that explains how to interpret a null value.

    +

    + Note that there are other reasonable approaches that a different application + might take. For example, an application may consider the presence of + two different values for "default" to be an error, regardless of their + schema locations.

    +
    +
    +
    +7.7.1.2. Annotations and Assertions +
    +

    + Schema objects that produce a false assertion result MUST NOT + produce any annotation results, whether from their own keywords + or from keywords in subschemas.

    +

    + Note that the overall schema results may still include annotations + collected from other schema locations. Given this schema:

    +
    +
    +
    +{
    +    "oneOf": [
    +        {
    +            "title": "Integer Value",
    +            "type": "integer"
    +        },
    +        {
    +            "title": "String Value",
    +            "type": "string"
    +        }
    +    ]
    +}
    +
    +
    +
    +

    + Against the instance "This is a string", the + title annotation "Integer Value" is discarded because the type assertion + in that schema object fails. The title annotation "String Value" + is kept, as the instance passes the string type assertions.

    +
    +
    +
    +7.7.1.3. Annotations and Applicators +
    +

    + In addition to possibly defining annotation results of their own, + applicator keywords aggregate the annotations collected in their + subschema(s) or referenced schema(s).

    +
    +
    +
    +
    +
    +

    +7.8. Reserved Locations +

    +

    + A fourth category of keywords simply reserve a location to hold re-usable + components or data of interest to schema authors that is not suitable + for re-use. These keywords do not affect validation or annotation results. + Their purpose in the core vocabulary is to ensure that locations are + available for certain purposes and will not be redefined by extension + keywords.

    +

    + While these keywords do not directly affect results, as explained in section + 9.4.2 unrecognized + extension keywords that reserve locations for re-usable schemas may have + undesirable interactions with references in certain circumstances.

    +
    +
    +

    +7.9. Loading Instance Data +

    +

    + While none of the vocabularies defined as part of this or the associated documents + define a keyword which may target and/or load instance data, it is possible that + other vocabularies may wish to do so.

    +

    + Keywords MAY be defined to use JSON Pointers or Relative JSON Pointers to examine + parts of an instance outside the current evaluation location.

    +

    + Keywords that allow adjusting the location using a Relative JSON Pointer SHOULD + default to using the current location if a default is desireable.

    +
    +
    +
    +

    +8. The JSON Schema Core Vocabulary +

    +

    + Keywords declared in this section, which all begin with "$", make up + the JSON Schema Core vocabulary. These keywords are either required in + order to process any schema or meta-schema, including those split across + multiple documents, or exist to reserve keywords for purposes that + require guaranteed interoperability.

    +

    + The Core vocabulary MUST be considered mandatory at all times, in order + to bootstrap the processing of further vocabularies. Meta-schemas + that use the "$vocabulary" (Section 8.1) keyword + to declare the vocabularies in use MUST explicitly list the Core vocabulary, + which MUST have a value of true indicating that it is required.

    +

    + The behavior of a false value for this vocabulary (and only this + vocabulary) is undefined, as is the behavior when "$vocabulary" + is present but the Core vocabulary is not included. However, it + is RECOMMENDED that implementations detect these cases and raise + an error when they occur. It is not meaningful to declare that + a meta-schema optionally uses Core.

    +

    + Meta-schemas that do not use "$vocabulary" MUST be considered to + require the Core vocabulary as if its URI were present with a value of true.

    +

    + The current URI for the Core vocabulary is: + <https://json-schema.org/draft/2020-12/vocab/core>.

    +

    + The current URI for the corresponding meta-schema is: + https://json-schema.org/draft/2020-12/meta/core.

    +

    + While the "$" prefix is not formally reserved for the Core vocabulary, + it is RECOMMENDED that extension keywords (in vocabularies or otherwise) + begin with a character other than "$" to avoid possible future collisions.

    +
    +
    +

    +8.1. Meta-Schemas and Vocabularies +

    +

    + Two concepts, meta-schemas and vocabularies, are used to inform an implementation + how to interpret a schema. Every schema has a meta-schema, which can be declared + using the "$schema" keyword.

    +

    + The meta-schema serves two purposes:

    +
    +
    Declaring the vocabularies in use
    +
    + The "$vocabulary" keyword, when it appears in a meta-schema, declares + which vocabularies are available to be used in schemas that refer + to that meta-schema. Vocabularies define keyword semantics, + as well as their general syntax. +
    +
    +
    Describing valid schema syntax
    +
    + A schema MUST successfully validate against its meta-schema, which + constrains the syntax of the available keywords. The syntax described + is expected to be compatible with the vocabularies declared; while + it is possible to describe an incompatible syntax, such a meta-schema + would be unlikely to be useful. +
    +
    +
    +

    + Meta-schemas are separate from vocabularies to allow for + vocabularies to be combined in different ways, and for meta-schema authors + to impose additional constraints such as forbidding certain keywords, or + performing unusually strict syntactical validation, as might be done + during a development and testing cycle. Each vocabulary typically identifies + a meta-schema consisting only of the vocabulary's keywords.

    +

    + Meta-schema authoring is an advanced usage of JSON Schema, so the design of + meta-schema features emphasizes flexibility over simplicity.

    +
    +
    +

    +8.1.1. The "$schema" Keyword +

    +

    + The "$schema" keyword is both used as a JSON Schema dialect identifier and + as the identifier of a resource which is itself a JSON Schema, which describes the + set of valid schemas written for this particular dialect.

    +

    + The value of this keyword MUST be a URI [RFC3986] + (containing a scheme) and this URI MUST be normalized. + The current schema MUST be valid against the meta-schema identified by this URI.

    +

    + If this URI identifies a retrievable resource, that resource SHOULD be of + media type "application/schema+json".

    +

    + The "$schema" keyword SHOULD be used in the document root schema object, + and MAY be used in the root schema objects of embedded schema resources. + It MUST NOT appear in non-resource root schema objects. If absent from + the document root schema, the resulting behavior is implementation-defined.

    +

    + Values for this property are defined elsewhere in this and other documents, + and by other parties.

    +
    +
    +
    +

    +8.1.2. The "$vocabulary" Keyword +

    +

    + The "$vocabulary" keyword is used in meta-schemas to identify the + vocabularies available for use in schemas described by that meta-schema. + It is also used to indicate whether each vocabulary is required or optional, + in the sense that an implementation MUST understand the required vocabularies + in order to successfully process the schema. Together, this information forms + a dialect. Any vocabulary that is understood by the implementation MUST be + processed in a manner consistent with the semantic definitions contained + within the vocabulary.

    +

    + The value of this keyword MUST be an object. The property names in the + object MUST be URIs (containing a scheme) and this URI MUST be normalized. + Each URI that appears as a property name identifies a specific set of + keywords and their semantics.

    +

    + The URI MAY be a URL, but the nature of the retrievable resource is + currently undefined, and reserved for future use. Vocabulary authors + MAY use the URL of the vocabulary specification, in a human-readable + media type such as text/html or text/plain, as the vocabulary URI. + + Vocabulary documents may be added in forthcoming drafts. + For now, identifying the keyword set is deemed sufficient as that, + along with meta-schema validation, is how the current "vocabularies" + work today. Any future vocabulary document format will be specified + as a JSON document, so using text/html or other non-JSON formats + in the meantime will not produce any future ambiguity. +

    +

    + The values of the object properties MUST be booleans. + If the value is true, then implementations that do not recognize + the vocabulary MUST refuse to process any schemas that declare + this meta-schema with "$schema". If the value is false, implementations + that do not recognize the vocabulary SHOULD proceed with processing + such schemas. The value has no impact if the implementation + understands the vocabulary.

    +

    + Per 6.5, unrecognized + keywords SHOULD be treated as annotations. + This remains the case for keywords defined + by unrecognized vocabularies. It is not currently possible to distinguish + between unrecognized keywords that are defined in vocabularies from + those that are not part of any vocabulary.

    +

    + The "$vocabulary" keyword SHOULD be used in the root schema of any schema + document intended for use as a meta-schema. It MUST NOT appear in subschemas.

    +

    + The "$vocabulary" keyword MUST be ignored in schema documents that + are not being processed as a meta-schema. This allows validating + a meta-schema M against its own meta-schema M' without requiring + the validator to understand the vocabularies declared by M.

    +
    +
    +8.1.2.1. Default vocabularies +
    +

    + If "$vocabulary" is absent, an implementation MAY determine + behavior based on the meta-schema if it is recognized from the + URI value of the referring schema's "$schema" keyword. + This is how behavior (such as Hyper-Schema usage) has been + recognized prior to the existence of vocabularies.

    +

    + If the meta-schema, as referenced by the schema, is not recognized, + or is missing, then the behavior is implementation-defined. + If the implementation + proceeds with processing the schema, it MUST assume the use of the + core vocabulary. If the implementation is built for a specific purpose, + then it SHOULD assume the use of all of the most relevant vocabularies + for that purpose.

    +

    + For example, an implementation that is a validator + SHOULD assume the use of all vocabularies in this + specification and the companion Validation specification.

    +
    +
    +
    +8.1.2.2. Non-inheritability of vocabularies +
    +

    + Note that the processing restrictions on "$vocabulary" mean that + meta-schemas that reference other meta-schemas using "$ref" or + similar keywords do not automatically inherit the vocabulary + declarations of those other meta-schemas. All such declarations + must be repeated in the root of each schema document intended + for use as a meta-schema. This is demonstrated in + the example meta-schema (Appendix D.2). + + This requirement allows implementations to find all vocabulary + requirement information in a single place for each meta-schema. + As schema extensibility means that there are endless potential + ways to combine more fine-grained meta-schemas by reference, + requiring implementations to anticipate all possibilities and + search for vocabularies in referenced meta-schemas would + be overly burdensome. +

    +
    +
    +
    +

    +8.1.3. Updates to Meta-Schema and Vocabulary URIs +

    +

    + Updated vocabulary and meta-schema URIs MAY be published between + specification drafts in order to correct errors. Implementations + SHOULD consider URIs dated after this specification draft and + before the next to indicate the same syntax and semantics + as those listed here.

    +
    +
    +
    +
    +

    +8.2. Base URI, Anchors, and Dereferencing +

    +

    + To differentiate between schemas in a vast ecosystem, schemas are + identified by URI [RFC3986], and can embed references + to other schemas by specifying their URI.

    +

    + Several keywords can accept a relative URI-reference [RFC3986], + or a value used to construct a relative URI-reference. For these keywords, + it is necessary to establish a base URI in order to resolve the reference.

    +
    +
    +

    +8.2.1. The "$id" Keyword +

    +

    + The "$id" keyword identifies a schema resource with its + canonical [RFC6596] URI.

    +

    + Note that this URI is an identifier and not necessarily a network locator. + In the case of a network-addressable URL, a schema need not be downloadable + from its canonical URI.

    +

    + If present, the value for this keyword MUST be a string, and MUST represent a + valid URI-reference [RFC3986]. This URI-reference + SHOULD be normalized, and MUST resolve to an + absolute-URI [RFC3986] (without a fragment), + or to a URI with an empty fragment.

    +

    + The empty fragment form is NOT RECOMMENDED and is retained only + for backwards compatibility, and because the + application/schema+json media type defines that a URI with an + empty fragment identifies the same resource as the same URI + with the fragment removed. However, since this equivalence is not + part of the RFC 3986 normalization process [RFC3986], + implementers and schema authors cannot rely on generic URI libraries + understanding it.

    +

    + Therefore, "$id" MUST NOT contain a non-empty fragment, and SHOULD NOT + contain an empty fragment. The absolute-URI form MUST be considered + the canonical URI, regardless of the presence or absence of an empty fragment. + + An empty fragment is currently allowed because older meta-schemas have + an empty fragment in their $id (or previously, id). + A future draft may outright forbid even empty fragments in "$id". +

    +

    + The absolute-URI also serves as the base URI for relative URI-references + in keywords within the schema resource, in accordance with + RFC 3986 section 5.1.1 [RFC3986] regarding base URIs + embedded in content.

    +

    + The presence of "$id" in a subschema indicates that the subschema constitutes + a distinct schema resource within a single schema document. Furthermore, + in accordance with RFC 3986 section 5.1.2 [RFC3986] + regarding encapsulating entities, if an "$id" in a subschema is a relative + URI-reference, the base URI for resolving that reference is the URI of + the parent schema resource.

    +

    + If no parent schema object explicitly identifies itself as a resource + with "$id", the base URI is that of the entire document, as established + by the steps given in the previous section. (Section 9.1.1)

    +
    +
    +8.2.1.1. Identifying the root schema +
    +

    + The root schema of a JSON Schema document SHOULD contain an "$id" keyword + with an absolute-URI [RFC3986] (containing a scheme, + but no fragment).

    +
    +
    +
    +
    +
    +

    +8.2.2. Defining location-independent identifiers +

    +

    + Using JSON Pointer fragments requires knowledge of the structure of the schema. + When writing schema documents with the intention to provide re-usable + schemas, it may be preferable to use a plain name fragment that is not tied to + any particular structural location. This allows a subschema to be relocated + without requiring JSON Pointer references to be updated.

    +

    + The "$anchor" and "$dynamicAnchor" keywords are used to specify such + fragments. They are identifier keywords that can only be used to create + plain name fragments, rather than absolute URIs as seen with "$id".

    +

    + The base URI to which the resulting fragment is appended is the canonical + URI of the schema resource containing the "$anchor" or "$dynamicAnchor" + in question. As discussed in the previous section, this is either the + nearest "$id" in the same or parent schema object, or the base URI + for the document as determined according to RFC 3986.

    +

    + Separately from the usual usage of URIs, "$dynamicAnchor" + indicates that the fragment is an extension point when used with + the "$dynamicRef" keyword. This low-level, advanced feature + makes it easier to extend recursive schemas such as the meta-schemas, + without imposing any particular semantics on that extension. + See the section on "$dynamicRef" (Section 8.2.3.2) + for details.

    +

    + In most cases, the normal fragment behavior both suffices and + is more intuitive. Therefore it is RECOMMENDED that "$anchor" + be used to create plain name fragments unless there is a clear + need for "$dynamicAnchor".

    +

    + If present, the value of this keyword MUST be a string and MUST start with + a letter ([A-Za-z]) or underscore ("_"), followed by any number of letters, + digits ([0-9]), hyphens ("-"), underscores ("_"), and periods ("."). + This matches the US-ASCII part of XML's + NCName production [xml-names]. + + Note that the anchor string does not include the "#" character, + as it is not a URI-reference. An "$anchor": "foo" becomes the + fragment "#foo" when used in a URI. See below for full examples. +

    +

    + The effect of specifying the same fragment name multiple times within + the same resource, using any combination of "$anchor" and/or + "$dynamicAnchor", is undefined. Implementations MAY + raise an error if such usage is detected.

    +
    +
    +
    +
    +

    +8.2.3. Schema References +

    +

    + Several keywords can be used to reference a schema which is to be applied to the + current instance location. "$ref" and "$dynamicRef" are applicator + keywords, applying the referenced schema to the instance.

    +

    + As the values of "$ref" and "$dynamicRef" are URI References, this allows + the possibility to externalise or divide a schema across multiple files, + and provides the ability to validate recursive structures through + self-reference.

    +

    + The resolved URI produced by these keywords is not necessarily a network + locator, only an identifier. A schema need not be downloadable from the + address if it is a network-addressable URL, and implementations SHOULD NOT + assume they should perform a network operation when they encounter + a network-addressable URI.

    +
    +
    +
    +8.2.3.1. Direct References with "$ref" +
    +

    + The "$ref" keyword is an applicator that is used to reference a statically + identified schema. Its results are the results of the referenced schema. + + Note that this definition of how the results are determined means that + other keywords can appear alongside of "$ref" in the same schema object. +

    +

    + The value of the "$ref" keyword MUST be a string which is a URI-Reference. + Resolved against the current URI base, it produces the URI of the schema + to apply. This resolution is safe to perform on schema load, as the + process of evaluating an instance cannot change how the reference resolves.

    +
    +
    +
    +
    +
    +8.2.3.2. Dynamic References with "$dynamicRef" +
    +

    + The "$dynamicRef" keyword is an applicator that allows for deferring the + full resolution until runtime, at which point it is resolved each time it is + encountered while evaluating an instance.

    +

    + Together with "$dynamicAnchor", "$dynamicRef" implements a cooperative + extension mechanism that is primarily useful with recursive schemas + (schemas that reference themselves). Both the extension point and the + runtime-determined extension target are defined with "$dynamicAnchor", + and only exhibit runtime dynamic behavior when referenced with + "$dynamicRef".

    +

    + The value of the "$dynamicRef" property MUST be a string which is + a URI-Reference. Resolved against the current URI base, it produces + the URI used as the starting point for runtime resolution. This initial + resolution is safe to perform on schema load.

    +

    + If the initially resolved starting point URI includes a fragment that + was created by the "$dynamicAnchor" keyword, the initial URI MUST be + replaced by the URI (including the fragment) for the outermost schema + resource in the dynamic scope (Section 7.1) that defines + an identically named fragment with "$dynamicAnchor".

    +

    + Otherwise, its behavior is identical to "$ref", and no runtime + resolution is needed.

    +

    + For a full example using these keyword, see appendix + C. + + The difference between the hyper-schema meta-schema in pre-2019 + drafts and an this draft dramatically demonstrates the utility + of these keywords. +

    +
    +
    +
    +
    +
    +
    +

    +8.2.4. Schema Re-Use With "$defs" +

    +

    + The "$defs" keyword reserves a location for schema + authors to inline re-usable JSON Schemas into a more general schema. + The keyword does not directly affect the validation result.

    +

    + This keyword's value MUST be an object. + Each member value of this object MUST be a valid JSON Schema.

    +

    + As an example, here is a schema describing an array of positive + integers, where the positive integer constraint is a subschema in + "$defs":

    +
    +
    +
    +{
    +    "type": "array",
    +    "items": { "$ref": "#/$defs/positiveInteger" },
    +    "$defs": {
    +        "positiveInteger": {
    +            "type": "integer",
    +            "exclusiveMinimum": 0
    +        }
    +    }
    +}
    +
    +
    +
    +
    +
    +
    +
    +

    +8.3. Comments With "$comment" +

    +

    + This keyword reserves a location for comments from schema authors + to readers or maintainers of the schema.

    +

    + The value of this keyword MUST be a string. Implementations MUST NOT present this + string to end users. Tools for editing schemas SHOULD support displaying and + editing this keyword. The value of this keyword MAY be used in debug or error + output which is intended for developers making use of schemas.

    +

    + Schema vocabularies SHOULD allow "$comment" within any object containing + vocabulary keywords. Implementations MAY assume "$comment" is allowed + unless the vocabulary specifically forbids it. Vocabularies MUST NOT + specify any effect of "$comment" beyond what is described in this + specification.

    +

    + Tools that translate other media types or programming languages + to and from application/schema+json MAY choose to convert that media type or + programming language's native comments to or from "$comment" values. + The behavior of such translation when both native comments and "$comment" + properties are present is implementation-dependent.

    +

    + Implementations MAY strip "$comment" values at any point during processing. + In particular, this allows for shortening schemas when the size of deployed + schemas is a concern.

    +

    + Implementations MUST NOT take any other action based on the presence, absence, + or contents of "$comment" properties. In particular, the value of "$comment" + MUST NOT be collected as an annotation result.

    +
    +
    +
    +

    +9. Loading and Processing Schemas +

    +

    +
    +

    +9.1. Loading a Schema +

    +
    +
    +

    +9.1.1. Initial Base URI +

    +

    + RFC3986 Section 5.1 [RFC3986] defines how to determine the + default base URI of a document.

    +

    + Informatively, the initial base URI of a schema is the URI at which it was + found, whether that was a network location, a local filesystem, or any other + situation identifiable by a URI of any known scheme.

    +

    + If a schema document defines no explicit base URI with "$id" + (embedded in content), the base URI is that determined per + RFC 3986 section 5 [RFC3986].

    +

    + If no source is known, or no URI scheme is known for the source, a suitable + implementation-specific default URI MAY be used as described in + RFC 3986 Section 5.1.4 [RFC3986]. It is RECOMMENDED + that implementations document any default base URI that they assume.

    +

    + If a schema object is embedded in a document of another media type, then + the initial base URI is determined according to the rules of that + media type.

    +

    + Unless the "$id" keyword described in an earlier section is present in the + root schema, this base URI SHOULD be considered the canonical URI of the + schema document's root schema resource.

    +
    +
    +
    +

    +9.1.2. Loading a referenced schema +

    +

    + The use of URIs to identify remote schemas does not necessarily mean anything is downloaded, + but instead JSON Schema implementations SHOULD understand ahead of time which schemas they will be using, + and the URIs that identify them.

    +

    + When schemas are downloaded, + for example by a generic user-agent that does not know until runtime which schemas to download, + see Usage for Hypermedia (Section 9.5.1).

    +

    + Implementations SHOULD be able to associate arbitrary URIs with an arbitrary + schema and/or automatically associate a schema's "$id"-given URI, depending + on the trust that the validator has in the schema. Such URIs and schemas + can be supplied to an implementation prior to processing instances, or may + be noted within a schema document as it is processed, producing associations + as shown in appendix A.

    +

    + A schema MAY (and likely will) have multiple URIs, but there is no way for a + URI to identify more than one schema. When multiple schemas try to identify + as the same URI, validators SHOULD raise an error condition.

    +
    +
    +

    +9.1.3. Detecting a Meta-Schema +

    +

    + Implementations MUST recognize a schema as a meta-schema if it + is being examined because it was identified as such by another + schema's "$schema" keyword. This means that a single schema + document might sometimes be considered a regular schema, and + other times be considered a meta-schema.

    +

    + In the case of examining a schema which is its own meta-schema, + when an implementation begins processing it as a regular schema, + it is processed under those rules. However, when loaded a second + time as a result of checking its own "$schema" value, it is treated + as a meta-schema. So the same document is processed both ways in + the course of one session.

    +

    + Implementations MAY allow a schema to be explicitly passed as a meta-schema, + for implementation-specific purposes, such as pre-loading a commonly + used meta-schema and checking its vocabulary support requirements + up front. Meta-schema authors MUST NOT expect such features to be + interoperable across implementations.

    +
    +
    +
    +

    +9.2. Dereferencing +

    +

    + Schemas can be identified by any URI that has been given to them, including + a JSON Pointer or their URI given directly by "$id". In all cases, + dereferencing a "$ref" reference involves first resolving its value as a + URI reference against the current base URI per + RFC 3986 [RFC3986].

    +

    + If the resulting URI identifies a schema within the current document, or + within another schema document that has been made available to the implementation, + then that schema SHOULD be used automatically.

    +

    + For example, consider this schema:

    +
    +
    +
    +{
    +    "$id": "https://example.net/root.json",
    +    "items": {
    +        "type": "array",
    +        "items": { "$ref": "#item" }
    +    },
    +    "$defs": {
    +        "single": {
    +            "$anchor": "item",
    +            "type": "object",
    +            "additionalProperties": { "$ref": "other.json" }
    +        }
    +    }
    +}
    +
    +
    +
    +

    + When an implementation encounters the <#/$defs/single> schema, + it resolves the "$anchor" value as a fragment name against the current + base URI to form <https://example.net/root.json#item>.

    +

    + When an implementation then looks inside the <#/items> schema, it + encounters the <#item> reference, and resolves this to + <https://example.net/root.json#item>, which it has seen defined in + this same document and can therefore use automatically.

    +

    + When an implementation encounters the reference to "other.json", it resolves + this to <https://example.net/other.json>, which is not defined in this + document. If a schema with that identifier has otherwise been supplied to + the implementation, it can also be used automatically. + + What should implementations do when the referenced schema is not known? + Are there circumstances in which automatic network dereferencing is + allowed? A same origin policy? A user-configurable option? In the + case of an evolving API described by Hyper-Schema, it is expected that + new schemas will be added to the system dynamically, so placing an + absolute requirement of pre-loading schema documents is not feasible. +

    +
    +
    +

    +9.2.1. JSON Pointer fragments and embedded schema resources +

    +

    + Since JSON Pointer URI fragments are constructed based on the structure + of the schema document, an embedded schema resource and its subschemas + can be identified by JSON Pointer fragments relative to either its own + canonical URI, or relative to any containing resource's URI.

    +

    + Conceptually, a set of linked schema resources should behave + identically whether each resource is a separate document connected with + schema references (Section 8.2.3), or is structured as + a single document with one or more schema resources embedded as + subschemas.

    +

    + Since URIs involving JSON Pointer fragments relative to the parent + schema resource's URI cease to be valid when the embedded schema + is moved to a separate document and referenced, applications and schemas + SHOULD NOT use such URIs to identify embedded schema resources or + locations within them.

    +

    + Consider the following schema document that contains another + schema resource embedded within it:

    +
    +
    +
    +{
    +    "$id": "https://example.com/foo",
    +    "items": {
    +        "$id": "https://example.com/bar",
    +        "additionalProperties": { }
    +    }
    +}
    +
    +
    +
    +

    + The URI "https://example.com/foo#/items" points to the "items" schema, + which is an embedded resource. The canonical URI of that schema + resource, however, is "https://example.com/bar".

    +

    + For the "additionalProperties" schema within that embedded resource, + the URI "https://example.com/foo#/items/additionalProperties" points + to the correct object, but that object's URI relative to its resource's + canonical URI is "https://example.com/bar#/additionalProperties".

    +

    + Now consider the following two schema resources linked by reference + using a URI value for "$ref":

    +
    +
    +
    +{
    +    "$id": "https://example.com/foo",
    +    "items": {
    +        "$ref": "bar"
    +    }
    +}
    +
    +{
    +    "$id": "https://example.com/bar",
    +    "additionalProperties": { }
    +}
    +
    +
    +
    +

    + Here we see that "https://example.com/bar#/additionalProperties", + using a JSON Pointer fragment appended to the canonical URI of + the "bar" schema resource, is still valid, while + "https://example.com/foo#/items/additionalProperties", which relied + on a JSON Pointer fragment appended to the canonical URI of the + "foo" schema resource, no longer resolves to anything.

    +

    + Note also that "https://example.com/foo#/items" is valid in both + arrangements, but resolves to a different value. This URI ends up + functioning similarly to a retrieval URI for a resource. While this URI + is valid, it is more robust to use the "$id" of the embedded or referenced + resource unless it is specifically desired to identify the object containing + the "$ref" in the second (non-embedded) arrangement.

    +

    + An implementation MAY choose not to support addressing schema resource + contents by URIs using a base other than the resource's canonical URI, + plus a JSON Pointer fragment relative to that base. Therefore, schema + authors SHOULD NOT rely on such URIs, as using them may reduce interoperability. + + This is to avoid requiring implementations to keep track of a whole + stack of possible base URIs and JSON Pointer fragments for each, + given that all but one will be fragile if the schema resources + are reorganized. Some + have argued that this is easy so there is + no point in forbidding it, while others have argued that it complicates + schema identification and should be forbidden. Feedback on this + topic is encouraged. + After some discussion, we feel that we need to remove the use of + "canonical" in favour of talking about JSON Pointers which reference + across schema resource boundaries as undefined or even forbidden behavior + (https://github.com/json-schema-org/json-schema-spec/issues/937, + https://github.com/json-schema-org/json-schema-spec/issues/1183) +

    +

    + Further examples of such non-canonical URI construction, as well as + the appropriate canonical URI-based fragments to use instead, + are provided in appendix A.

    +
    +
    +
    +
    +

    +9.3. Compound Documents +

    +

    + A Compound Schema Document is defined as a JSON document (sometimes called a "bundled" schema) + which has multiple embedded JSON Schema Resources bundled into the same document to + ease transportation.

    +

    + Each embedded Schema Resource MUST be treated as an individual Schema Resource, following standard + schema loading and processing requirements, including determining vocabulary support.

    +
    +

    +9.3.1. Bundling +

    +

    + The bundling process for creating a Compound Schema Document is defined as taking + references (such as "$ref") to an external Schema Resource and embedding the referenced + Schema Resources within the referring document. Bundling SHOULD be done in such a way that + all URIs (used for referencing) in the base document and any referenced/embedded + documents do not require altering.

    +

    + Each embedded JSON Schema Resource MUST identify itself with a URI using the "$id" keyword, + and SHOULD make use of the "$schema" keyword to identify the dialect it is using, in the root of the + schema resource. It is RECOMMENDED that the URI identifier value of "$id" be an Absolute URI.

    +

    + When the Schema Resource referenced by a by-reference applicator is bundled, it is RECOMMENDED that + the Schema Resource be located as a value of a "$defs" object at the containing schema's root. + The key of the "$defs" for the now embedded Schema Resource MAY be the "$id" of the bundled schema + or some other form of application defined unique identifer (such as a UUID). This key is not + intended to be referenced in JSON Schema, but may be used by an application to aid the + bundling process.

    +

    + A Schema Resource MAY be embedded in a location other than "$defs" where the location is defined + as a schema value.

    +

    + A Bundled Schema Resource MUST NOT be bundled by replacing the schema object from which it was + referenced, or by wrapping the Schema Resource in other applicator keywords.

    +

    + In order to produce identical output, references in the containing schema document to the + previously external Schema Resources MUST NOT be changed, and now resolve to a schema using the + "$id" of an embedded Schema Resource. Such identical output includes validation evaluation and URIs + or paths used in resulting annotations or errors.

    +

    + While the bundling process will often be the main method for creating a Compound Schema Document, + it is also possible and expected that some will be created by hand, potentially without individual + Schema Resources existing on their own previously.

    +
    +
    +

    +9.3.2. Differing and Default Dialects +

    +

    + When multiple schema resources are present in a single document, + schema resources which do not define with which dialect they should be processed + MUST be processed with the same dialect as the enclosing resource.

    +

    + Since any schema that can be referenced can also be embedded, embedded schema resources MAY + specify different processing dialects using the "$schema" values from their enclosing resource.

    +
    +
    +

    +9.3.3. Validating +

    +

    + Given that a Compound Schema Document may have embedded resources which identify as using different + dialects, these documents SHOULD NOT be validated by applying a meta-schema + to the Compound Schema Document as an instance. It is RECOMMENDED that an alternate + validation process be provided in order to validate Schema Documents. Each Schema Resource + SHOULD be separately validated against its associated meta-schema. + + If you know a schema is what's being validated, you can identify if the schemas + is a Compound Schema Document or not, by way of use of "$id", which identifies an + embedded resource when used not at the document's root. +

    +

    + A Compound Schema Document in which all embedded resources identify as using the same + dialect, or in which "$schema" is omitted and therefore defaults to that of the enclosing resource, + MAY be validated by applying the appropriate meta-schema.

    +
    +
    +
    +

    +9.4. Caveats +

    +
    +

    +9.4.1. Guarding Against Infinite Recursion +

    +

    + A schema MUST NOT be run into an infinite loop against an instance. For + example, if two schemas "#alice" and "#bob" both have an "allOf" property + that refers to the other, a naive validator might get stuck in an infinite + recursive loop trying to validate the instance. Schemas SHOULD NOT make + use of infinite recursive nesting like this; the behavior is undefined.

    +
    +
    +
    +

    +9.4.2. References to Possible Non-Schemas +

    +

    + Subschema objects (or booleans) are recognized by their use with known + applicator keywords or with location-reserving keywords such as + "$defs" (Section 8.2.4) that take one or more subschemas + as a value. These keywords may be "$defs" and the standard applicators + from this document, or extension keywords from a known vocabulary, or + implementation-specific custom keywords.

    +

    + Multi-level structures of unknown keywords are capable of introducing + nested subschemas, which would be subject to the processing rules for + "$id". Therefore, having a reference target in such an unrecognized + structure cannot be reliably implemented, and the resulting behavior + is undefined. Similarly, a reference target under a known keyword, + for which the value is known not to be a schema, results in undefined + behavior in order to avoid burdening implementations with the need + to detect such targets. + + These scenarios are analogous to fetching a schema over HTTP + but receiving a response with a Content-Type other than + application/schema+json. An implementation can certainly + try to interpret it as a schema, but the origin server + offered no guarantee that it actually is any such thing. + Therefore, interpreting it as such has security implications + and may produce unpredictable results. +

    +

    + Note that single-level custom keywords with identical syntax and + semantics to "$defs" do not allow for any intervening "$id" keywords, + and therefore will behave correctly under implementations that attempt + to use any reference target as a schema. However, this behavior is + implementation-specific and MUST NOT be relied upon for interoperability.

    +
    +
    +
    +
    +

    +9.5. Associating Instances and Schemas +

    +
    +
    +

    +9.5.1. Usage for Hypermedia +

    +

    + JSON has been adopted widely by HTTP servers for automated APIs and robots. This + section describes how to enhance processing of JSON documents in a more RESTful + manner when used with protocols that support media types and + Web linking [RFC8288].

    +
    +
    +9.5.1.1. Linking to a Schema +
    +

    + It is RECOMMENDED that instances described by a schema provide a link to + a downloadable JSON Schema using the link relation "describedby", as defined by + Linked Data Protocol 1.0, section 8.1 [W3C.REC-ldp-20150226].

    +

    + In HTTP, such links can be attached to any response using the + Link header [RFC8288]. An example of such a header would be:

    +
    +
    +
    +        Link: <https://example.com/my-hyper-schema>; rel="describedby"
    +
    +
    +
    +
    +
    +
    +9.5.1.2. Usage Over HTTP +
    +

    + When used for hypermedia systems over a network, + HTTP [RFC7231] is frequently the protocol of choice for + distributing schemas. Misbehaving clients can pose problems for server + maintainers if they pull a schema over the network more frequently than + necessary, when it's instead possible to cache a schema for a long period of + time.

    +

    + HTTP servers SHOULD set long-lived caching headers on JSON Schemas. + HTTP clients SHOULD observe caching headers and not re-request documents within + their freshness period. + Distributed systems SHOULD make use of a shared cache and/or caching proxy.

    +

    + Clients SHOULD set or prepend a User-Agent header specific to the JSON Schema + implementation or software product. Since symbols are listed in decreasing order + of significance, the JSON Schema library name/version should precede the more + generic HTTP library name (if any). For example:

    +
    +
    +
    +        User-Agent: product-name/5.4.1 so-cool-json-schema/1.0.2 curl/7.43.0
    +
    +
    +
    +

    + Clients SHOULD be able to make requests with a "From" header so that server + operators can contact the owner of a potentially misbehaving script.

    +
    +
    +
    +
    +
    +
    +

    +10. A Vocabulary for Applying Subschemas +

    +

    + This section defines a vocabulary of applicator keywords that + are RECOMMENDED for use as the basis of other vocabularies.

    +

    + Meta-schemas that do not use "$vocabulary" SHOULD be considered to + require this vocabulary as if its URI were present with a value of true.

    +

    + The current URI for this vocabulary, known as the Applicator vocabulary, is: + <https://json-schema.org/draft/2020-12/vocab/applicator>.

    +

    + The current URI for the corresponding meta-schema is: + https://json-schema.org/draft/2020-12/meta/applicator.

    +
    +

    +10.1. Keyword Independence +

    +

    + Schema keywords typically operate independently, without + affecting each other's outcomes.

    +

    + For schema author convenience, there are some exceptions among the + keywords in this vocabulary:

    +
      +
    • + "additionalProperties", whose behavior is defined in terms of + "properties" and "patternProperties" +
    • +
    • + "items", whose behavior is defined in terms of "prefixItems" +
    • +
    • + "contains", whose behavior is affected by the presence and value of + "minContains", in the Validation vocabulary +
    • +
    +
    +
    +
    +

    +10.2. Keywords for Applying Subschemas in Place +

    +

    + These keywords apply subschemas to the same location in the instance + as the parent schema is being applied. They allow combining + or modifying the subschema results in various ways.

    +

    + Subschemas of these keywords evaluate the instance completely independently + such that the results of one such subschema MUST NOT impact the results of sibling + subschemas. Therefore subschemas may be applied in + any order.

    +
    +
    +

    +10.2.1. Keywords for Applying Subschemas With Logic +

    +

    + These keywords correspond to logical operators for combining or modifying + the boolean assertion results of the subschemas. They have no direct + impact on annotation collection, although they enable the same annotation + keyword to be applied to an instance location with different values. + Annotation keywords define their own rules for combining such values.

    +
    +
    +
    +10.2.1.1. allOf +
    +

    + This keyword's value MUST be a non-empty array. + Each item of the array MUST be a valid JSON Schema.

    +

    + An instance validates successfully against this keyword if it validates + successfully against all schemas defined by this keyword's value.

    +
    +
    +
    +
    +10.2.1.2. anyOf +
    +

    + This keyword's value MUST be a non-empty array. + Each item of the array MUST be a valid JSON Schema.

    +

    + An instance validates successfully against this keyword if it validates + successfully against at least one schema defined by this keyword's value. + Note that when annotations are being collected, all subschemas MUST + be examined so that annotations are collected from each subschema + that validates successfully.

    +
    +
    +
    +10.2.1.3. oneOf +
    +

    + This keyword's value MUST be a non-empty array. + Each item of the array MUST be a valid JSON Schema.

    +

    + An instance validates successfully against this keyword if it validates + successfully against exactly one schema defined by this keyword's value.

    +
    +
    +
    +
    +10.2.1.4. not +
    +

    + This keyword's value MUST be a valid JSON Schema.

    +

    + An instance is valid against this keyword if it fails to validate + successfully against the schema defined by this keyword.

    +
    +
    +
    +
    +
    +
    +

    +10.2.2. Keywords for Applying Subschemas Conditionally +

    +

    + Three of these keywords work together to implement conditional + application of a subschema based on the outcome of another subschema. + The fourth is a shortcut for a specific conditional case.

    +

    + "if", "then", and "else" MUST NOT interact with each other across + subschema boundaries. In other words, an "if" in one + branch of an "allOf" MUST NOT have an impact on a "then" + or "else" in another branch.

    +

    + There is no default behavior for "if", "then", or "else" + when they are not present. In particular, they MUST NOT + be treated as if present with an empty schema, and when + "if" is not present, both "then" and "else" MUST be + entirely ignored.

    +
    +
    +10.2.2.1. if +
    +

    + This keyword's value MUST be a valid JSON Schema.

    +

    + This validation outcome of this keyword's subschema + has no direct effect on the overall validation + result. Rather, it controls which of the "then" + or "else" keywords are evaluated.

    +

    + Instances that successfully validate against this + keyword's subschema MUST also be valid against + the subschema value of the "then" keyword, if + present.

    +

    + Instances that fail to validate against this + keyword's subschema MUST also be valid against + the subschema value of the "else" keyword, if + present.

    +

    + If annotations (Section 7.7) + are being collected, they are collected from this + keyword's subschema in the usual way, including when + the keyword is present without either "then" or "else".

    +
    +
    +
    +10.2.2.2. then +
    +

    + This keyword's value MUST be a valid JSON Schema.

    +

    + When "if" is present, and the instance successfully + validates against its subschema, then validation + succeeds against this keyword if the instance also + successfully validates against this keyword's subschema.

    +

    + This keyword has no effect when "if" is absent, or + when the instance fails to validate against its + subschema. Implementations MUST NOT evaluate + the instance against this keyword, for either validation + or annotation collection purposes, in such cases.

    +
    +
    +
    +10.2.2.3. else +
    +

    + This keyword's value MUST be a valid JSON Schema.

    +

    + When "if" is present, and the instance fails to + validate against its subschema, then validation + succeeds against this keyword if the instance + successfully validates against this keyword's subschema.

    +

    + This keyword has no effect when "if" is absent, or + when the instance successfully validates against its + subschema. Implementations MUST NOT evaluate + the instance against this keyword, for either validation + or annotation collection purposes, in such cases.

    +
    +
    +
    +10.2.2.4. dependentSchemas +
    +

    + This keyword specifies subschemas that are evaluated if the instance + is an object and contains a certain property.

    +

    + This keyword's value MUST be an object. + Each value in the object MUST be a valid JSON Schema.

    +

    + If the object key is a property in the instance, the entire + instance must validate against the subschema. Its use is + dependent on the presence of the property.

    +

    + Omitting this keyword has the same behavior as an empty object.

    +
    +
    +
    +
    +
    +
    +

    +10.3. Keywords for Applying Subschemas to Child Instances +

    +

    + Each of these keywords defines a rule for applying its + subschema(s) to child instances, specifically object + properties and array items, and combining their results.

    +
    +

    +10.3.1. Keywords for Applying Subschemas to Arrays +

    +
    +
    +10.3.1.1. prefixItems +
    +

    + The value of "prefixItems" MUST be a non-empty array of valid JSON Schemas.

    +

    + Validation succeeds if each element of the instance validates + against the schema at the same position, if any. This keyword + does not constrain the length of the array. If the array is longer + than this keyword's value, this keyword validates only the + prefix of matching length.

    +

    + This keyword produces an annotation value which is the largest + index to which this keyword applied a subschema. The value + MAY be a boolean true if a subschema was applied to every + index of the instance, such as is produced by the "items" keyword. + This annotation affects the behavior of "items" and "unevaluatedItems".

    +

    + Omitting this keyword has the same assertion behavior as + an empty array.

    +
    +
    +
    +
    +10.3.1.2. items +
    +

    + The value of "items" MUST be a valid JSON Schema.

    +

    + This keyword applies its subschema to all instance elements + at indexes greater than the length of the "prefixItems" array + in the same schema object, as reported by the annotation result + of that "prefixItems" keyword. If no such annotation + result exists, "items" applies its subschema to all instance + array elements. + + Note that the behavior of "items" without "prefixItems" is + identical to that of the schema form of "items" in prior drafts. + When "prefixItems" is present, the behavior of "items" is + identical to the former "additionalItems" keyword. +

    +

    + If the "items" subschema is applied to any + positions within the instance array, it produces an + annotation result of boolean true, indicating that all remaining array + elements have been evaluated against this keyword's subschema. + This annotation affects the behavior of "unevaluatedItems" in the + Unevaluated vocabulary.

    +

    + Omitting this keyword has the same assertion behavior as + an empty schema.

    +

    + Implementations MAY choose to implement or optimize this keyword + in another way that produces the same effect, such as by directly + checking for the presence and size of a "prefixItems" array. + Implementations that do not support annotation collection MUST do so.

    +
    +
    +
    +
    +10.3.1.3. contains +
    +

    + The value of this keyword MUST be a valid JSON Schema.

    +

    + An array instance is valid against "contains" if at least one of + its elements is valid against the given schema, + except when "minContains" is present and has a value of 0, in which + case an array instance MUST be considered valid against the "contains" keyword, + even if none of its elements is valid against the given schema.

    +

    + This keyword produces an annotation value which is an array of + the indexes to which this keyword validates successfully when applying + its subschema, in ascending order. The value MAY be a boolean "true" if + the subschema validates successfully when applied to every index of the + instance. The annotation MUST be present if the instance array to which + this keyword's schema applies is empty.

    +

    + This annotation affects the behavior of "unevaluatedItems" in the + Unevaluated vocabulary, and MAY also be used to implement the + "minContains" and "maxContains" keywords in the Validation vocabulary.

    +

    + The subschema MUST be applied to every array element even after the first + match has been found, in order to collect annotations for use by other + keywords. This is to ensure that all possible annotations are collected.

    +
    +
    +
    +

    +10.3.2. Keywords for Applying Subschemas to Objects +

    +
    +
    +10.3.2.1. properties +
    +

    + The value of "properties" MUST be an object. + Each value of this object MUST be a valid JSON Schema.

    +

    + Validation succeeds if, for each name that appears in both + the instance and as a name within this keyword's value, the child + instance for that name successfully validates against the + corresponding schema.

    +

    + The annotation result of this keyword is the set of instance + property names matched by this keyword. + This annotation affects the behavior of "additionalProperties" (in + this vocabulary) and "unevaluatedProperties" in the Unevaluated vocabulary.

    +

    + Omitting this keyword has the same assertion behavior as + an empty object.

    +
    +
    +
    +10.3.2.2. patternProperties +
    +

    + The value of "patternProperties" MUST be an object. Each property name + of this object SHOULD be a valid regular expression, according to the + ECMA-262 regular expression dialect. Each property value of this object + MUST be a valid JSON Schema.

    +

    + Validation succeeds if, for each instance name that matches any + regular expressions that appear as a property name in this keyword's value, + the child instance for that name successfully validates against each + schema that corresponds to a matching regular expression.

    +

    + The annotation result of this keyword is the set of instance + property names matched by this keyword. + This annotation affects the behavior of "additionalProperties" (in this + vocabulary) and "unevaluatedProperties" (in the Unevaluated vocabulary).

    +

    + Omitting this keyword has the same assertion behavior as + an empty object.

    +
    +
    +
    +
    +10.3.2.3. additionalProperties +
    +

    + The value of "additionalProperties" MUST be a valid JSON Schema.

    +

    + The behavior of this keyword depends on the presence and + annotation results of "properties" and "patternProperties" + within the same schema object. + Validation with "additionalProperties" applies only to the child + values of instance names that do not appear in the annotation + results of either "properties" or "patternProperties".

    +

    + For all such properties, validation succeeds if the child instance + validates against the "additionalProperties" schema.

    +

    + The annotation result of this keyword is the set of instance + property names validated by this keyword's subschema. + This annotation affects the behavior of "unevaluatedProperties" + in the Unevaluated vocabulary.

    +

    + Omitting this keyword has the same assertion behavior as + an empty schema.

    +

    + Implementations MAY choose to implement or optimize this keyword + in another way that produces the same effect, such as by directly + checking the names in "properties" and the patterns in + "patternProperties" against the instance property set. + Implementations that do not support annotation collection MUST do so. + + In defining this option, it seems there is the potential for + ambiguity in the output format. The ambiguity does not affect validation results, + but it does affect the resulting output format. + The ambiguity allows for multiple valid output results depending on whether annotations + are used or a solution that "produces the same effect" as draft-07. It is understood + that annotations from failing schemas are dropped. + See our + [Decision Record](https://github.com/json-schema-org/json-schema-spec/tree/HEAD/adr/2022-04-08-cref-for-ambiguity-and-fix-later-gh-spec-issue-1172.md) + for further details. +

    +
    +
    +
    +
    +10.3.2.4. propertyNames +
    +

    + The value of "propertyNames" MUST be a valid JSON Schema.

    +

    + If the instance is an object, this keyword validates if every property name in + the instance validates against the provided schema. + Note the property name that the schema is testing will always be a string.

    +

    + Omitting this keyword has the same behavior as an empty schema.

    +
    +
    +
    +
    +
    +

    +11. A Vocabulary for Unevaluated Locations +

    +

    + The purpose of these keywords is to enable schema authors to apply + subschemas to array items or object properties that have not been + successfully evaluated against any dynamic-scope subschema of any + adjacent keywords.

    +

    + These instance items or properties may have been unsuccessfully evaluated + against one or more adjacent keyword subschemas, such as when an assertion + in a branch of an "anyOf" fails. Such failed evaluations are not considered + to contribute to whether or not the item or property has been evaluated. + Only successful evaluations are considered.

    +

    + If an item in an array or an object property is "successfully evaluated", it + is logically considered to be valid in terms of the representation of the + object or array that's expected. For example if a subschema represents a car, + which requires between 2-4 wheels, and the value of "wheels" is 6, the instance + object is not "evaluated" to be a car, and the "wheels" property is considered + "unevaluated (successfully as a known thing)", and does not retain any annotations.

    +

    + Recall that adjacent keywords are keywords within the same schema object, + and that the dynamic-scope subschemas include reference targets as well as + lexical subschemas.

    +

    + The behavior of these keywords depend on the annotation results of + adjacent keywords that apply to the instance location being validated.

    +

    + Meta-schemas that do not use "$vocabulary" SHOULD be considered to + require this vocabulary as if its URI were present with a value of true.

    +

    + The current URI for this vocabulary, known as the Unevaluated Applicator + vocabulary, is: + <https://json-schema.org/draft/2020-12/vocab/unevaluated>.

    +

    + The current URI for the corresponding meta-schema is: + https://json-schema.org/draft/2020-12/meta/unevaluated.

    +
    +

    +11.1. Keyword Independence +

    +

    + Schema keywords typically operate independently, without + affecting each other's outcomes. However, the keywords in this + vocabulary are notable exceptions:

    +
      +
    • + "unevaluatedItems", whose behavior is defined in terms of annotations + from "prefixItems", "items", "contains", and itself +
    • +
    • + "unevaluatedProperties", whose behavior is defined in terms of + annotations from "properties", "patternProperties", + "additionalProperties" and itself +
    • +
    +
    +
    +
    +

    +11.2. unevaluatedItems +

    +

    + The value of "unevaluatedItems" MUST be a valid JSON Schema.

    +

    + The behavior of this keyword depends on the annotation results of + adjacent keywords that apply to the instance location being validated. + Specifically, the annotations from "prefixItems", "items", and "contains", + which can come from those keywords when they are adjacent to the + "unevaluatedItems" keyword. Those three annotations, as well as + "unevaluatedItems", can also result from any and all adjacent + in-place applicator (Section 10.2) keywords. + This includes but is not limited to the in-place applicators + defined in this document.

    +

    + If no relevant annotations are present, the "unevaluatedItems" + subschema MUST be applied to all locations in the array. + If a boolean true value is present from any of the relevant annotations, + "unevaluatedItems" MUST be ignored. Otherwise, the subschema + MUST be applied to any index greater than the largest annotation + value for "prefixItems", which does not appear in any annotation + value for "contains".

    +

    + This means that "prefixItems", "items", "contains", and all in-place + applicators MUST be evaluated before this keyword can be evaluated. + Authors of extension keywords MUST NOT define an in-place applicator + that would need to be evaluated after this keyword.

    +

    + If the "unevaluatedItems" subschema is applied to any + positions within the instance array, it produces an + annotation result of boolean true, analogous to the + behavior of "items". + This annotation affects the behavior of "unevaluatedItems" in parent schemas.

    +

    + Omitting this keyword has the same assertion behavior as + an empty schema.

    +
    +
    +
    +
    +

    +11.3. unevaluatedProperties +

    +

    + The value of "unevaluatedProperties" MUST be a valid JSON Schema.

    +

    + The behavior of this keyword depends on the annotation results of + adjacent keywords that apply to the instance location being validated. + Specifically, the annotations from "properties", "patternProperties", + and "additionalProperties", which can come from those keywords when + they are adjacent to the "unevaluatedProperties" keyword. Those + three annotations, as well as "unevaluatedProperties", can also + result from any and all adjacent + in-place applicator (Section 10.2) keywords. + This includes but is not limited to the in-place applicators + defined in this document.

    +

    + Validation with "unevaluatedProperties" applies only to the child + values of instance names that do not appear in the "properties", + "patternProperties", "additionalProperties", or + "unevaluatedProperties" annotation results that apply to the + instance location being validated.

    +

    + For all such properties, validation succeeds if the child instance + validates against the "unevaluatedProperties" schema.

    +

    + This means that "properties", "patternProperties", "additionalProperties", + and all in-place applicators MUST be evaluated before this keyword can + be evaluated. Authors of extension keywords MUST NOT define an in-place + applicator that would need to be evaluated after this keyword.

    +

    + The annotation result of this keyword is the set of instance + property names validated by this keyword's subschema. + This annotation affects the behavior of "unevaluatedProperties" in parent schemas.

    +

    + Omitting this keyword has the same assertion behavior as + an empty schema.

    +
    +
    +
    +
    +
    +

    +12. Output Formatting +

    +

    + JSON Schema is defined to be platform-independent. As such, to increase compatibility + across platforms, implementations SHOULD conform to a standard validation output + format. This section describes the minimum requirements that consumers will need to + properly interpret validation results.

    +
    +

    +12.1. Format +

    +

    + JSON Schema output is defined using the JSON Schema data instance model as described + in section 4.2.1. Implementations MAY deviate from this as supported by their + specific languages and platforms, however it is RECOMMENDED that the output be + convertible to the JSON format defined herein via serialization or other means.

    +
    +
    +

    +12.2. Output Formats +

    +

    + This specification defines four output formats. See the "Output Structure" + section for the requirements of each format.

    +
      +
    • + Flag - A boolean which simply indicates the overall validation result + with no further details. +
    • +
    • + Basic - Provides validation information in a flat list structure. +
    • +
    • + Detailed - Provides validation information in a condensed hierarchical + structure based on the structure of the schema. +
    • +
    • + Verbose - Provides validation information in an uncondensed hierarchical + structure that matches the exact structure of the schema. +
    • +
    +

    + An implementation SHOULD provide at least one of the "flag", "basic", or "detailed" + format and MAY provide the "verbose" format. If it provides one or more of the + "detailed" or "verbose" formats, it MUST also provide the "flag" format. + Implementations SHOULD specify in their documentation which formats they support.

    +
    +
    +

    +12.3. Minimum Information +

    +

    + Beyond the simplistic "flag" output, additional information is useful to aid in + debugging a schema or instance. Each sub-result SHOULD contain the information + contained within this section at a minimum.

    +

    + A single object that contains all of these components is considered an + output unit.

    +

    + Implementations MAY elect to provide additional information.

    +
    +

    +12.3.1. Keyword Relative Location +

    +

    + The relative location of the validating keyword that follows the validation + path. The value MUST be expressed as a JSON Pointer, and it MUST include + any by-reference applicators such as "$ref" or "$dynamicRef".

    +
    +
    +
    +/properties/width/$ref/minimum
    +
    +
    +
    +

    + Note that this pointer may not be resolvable by the normal JSON Pointer process + due to the inclusion of these by-reference applicator keywords.

    +

    + The JSON key for this information is "keywordLocation".

    +
    +
    +

    +12.3.2. Keyword Absolute Location +

    +

    + The absolute, dereferenced location of the validating keyword. The value MUST + be expressed as a full URI using the canonical URI of the relevant schema resource + with a JSON Pointer fragment, and it MUST NOT include by-reference applicators + such as "$ref" or "$dynamicRef" as non-terminal path components. + It MAY end in such keywords if the error or annotation is for that + keyword, such as an unresolvable reference. + + Note that "absolute" here is in the sense of "absolute filesystem path" + (meaning the complete location) rather than the "absolute-URI" + terminology from RFC 3986 (meaning with scheme but without fragment). + Keyword absolute locations will have a fragment in order to + identify the keyword. +

    +
    +
    +
    +https://example.com/schemas/common#/$defs/count/minimum
    +
    +
    +
    +

    + This information MAY be omitted only if either the dynamic scope did not pass + over a reference or if the schema does not declare an absolute URI as its "$id".

    +

    + The JSON key for this information is "absoluteKeywordLocation".

    +
    +
    +

    +12.3.3. Instance Location +

    +

    + The location of the JSON value within the instance being validated. The + value MUST be expressed as a JSON Pointer.

    +

    + The JSON key for this information is "instanceLocation".

    +
    +
    +

    +12.3.4. Error or Annotation +

    +

    + The error or annotation that is produced by the validation.

    +

    + For errors, the specific wording for the message is not defined by this + specification. Implementations will need to provide this.

    +

    + For annotations, each keyword that produces an annotation specifies its + format. By default, it is the keyword's value.

    +

    + The JSON key for failed validations is "error"; for successful validations + it is "annotation".

    +
    +
    +

    +12.3.5. Nested Results +

    +

    + For the two hierarchical structures, this property will hold nested errors + and annotations.

    +

    + The JSON key for nested results in failed validations is "errors"; for + successful validations it is "annotations". Note the plural forms, as + a keyword with nested results can also have a local error or annotation.

    +
    +
    +
    +

    +12.4. Output Structure +

    +

    + The output MUST be an object containing a boolean property named "valid". When + additional information about the result is required, the output MUST also contain + "errors" or "annotations" as described below.

    +
      +
    • + "valid" - a boolean value indicating the overall validation success or + failure +
    • +
    • + "errors" - the collection of errors or annotations produced by a failed + validation +
    • +
    • + "annotations" - the collection of errors or annotations produced by a + successful validation +
    • +
    +

    + For these examples, the following schema and instance will be used.

    +
    +
    +
    +{
    +  "$id": "https://example.com/polygon",
    +  "$schema": "https://json-schema.org/draft/2020-12/schema",
    +  "$defs": {
    +    "point": {
    +      "type": "object",
    +      "properties": {
    +        "x": { "type": "number" },
    +        "y": { "type": "number" }
    +      },
    +      "additionalProperties": false,
    +      "required": [ "x", "y" ]
    +    }
    +  },
    +  "type": "array",
    +  "items": { "$ref": "#/$defs/point" },
    +  "minItems": 3
    +}
    +
    +[
    +  {
    +    "x": 2.5,
    +    "y": 1.3
    +  },
    +  {
    +    "x": 1,
    +    "z": 6.7
    +  }
    +]
    +
    +
    +
    +

    + This instance will fail validation and produce errors, but it's trivial to deduce + examples for passing schemas that produce annotations.

    +

    + Specifically, the errors it will produce are:

    +
      +
    • + The second object is missing a "y" property. +
    • +
    • + The second object has a disallowed "z" property. +
    • +
    • + There are only two objects, but three are required. +
    • +
    +

    + Note that the error message wording as depicted in these examples is not a + requirement of this specification. Implementations SHOULD craft error messages + tailored for their audience or provide a templating mechanism that allows their + users to craft their own messages.

    +
    +

    +12.4.1. Flag +

    +

    + In the simplest case, merely the boolean result for the "valid" valid property + needs to be fulfilled.

    +
    +
    +
    +{
    +  "valid": false
    +}
    +
    +
    +
    +

    + Because no errors or annotations are returned with this format, it is + RECOMMENDED that implementations use short-circuiting logic to return + failure or success as soon as the outcome can be determined. For example, + if an "anyOf" keyword contains five sub-schemas, and the second one + passes, there is no need to check the other three. The logic can simply + return with success.

    +
    +
    +

    +12.4.2. Basic +

    +

    + The "Basic" structure is a flat list of output units.

    +
    +
    +
    +{
    +  "valid": false,
    +  "errors": [
    +    {
    +      "keywordLocation": "",
    +      "instanceLocation": "",
    +      "error": "A subschema had errors."
    +    },
    +    {
    +      "keywordLocation": "/items/$ref",
    +      "absoluteKeywordLocation":
    +        "https://example.com/polygon#/$defs/point",
    +      "instanceLocation": "/1",
    +      "error": "A subschema had errors."
    +    },
    +    {
    +      "keywordLocation": "/items/$ref/required",
    +      "absoluteKeywordLocation":
    +        "https://example.com/polygon#/$defs/point/required",
    +      "instanceLocation": "/1",
    +      "error": "Required property 'y' not found."
    +    },
    +    {
    +      "keywordLocation": "/items/$ref/additionalProperties",
    +      "absoluteKeywordLocation":
    +        "https://example.com/polygon#/$defs/point/additionalProperties",
    +      "instanceLocation": "/1/z",
    +      "error": "Additional property 'z' found but was invalid."
    +    },
    +    {
    +      "keywordLocation": "/minItems",
    +      "instanceLocation": "",
    +      "error": "Expected at least 3 items but found 2"
    +    }
    +  ]
    +}
    +
    +
    +
    +
    +
    +

    +12.4.3. Detailed +

    +

    + The "Detailed" structure is based on the schema and can be more readable + for both humans and machines. Having the structure organized this way makes + associations between the errors more apparent. For example, the fact that + the missing "y" property and the extra "z" property both stem from the same + location in the instance is not immediately obvious in the "Basic" structure. + In a hierarchy, the correlation is more easily identified.

    +

    + The following rules govern the construction of the results object:

    +
      +
    • + All applicator keywords ("*Of", "$ref", "if"/"then"/"else", etc.) require + a node. +
    • +
    • + Nodes that have no children are removed. +
    • +
    • + Nodes that have a single child are replaced by the child. +
    • +
    +

    + Branch nodes do not require an error message or an annotation.

    +
    +
    +
    +{
    +  "valid": false,
    +  "keywordLocation": "",
    +  "instanceLocation": "",
    +  "errors": [
    +    {
    +      "valid": false,
    +      "keywordLocation": "/items/$ref",
    +      "absoluteKeywordLocation":
    +        "https://example.com/polygon#/$defs/point",
    +      "instanceLocation": "/1",
    +      "errors": [
    +        {
    +          "valid": false,
    +          "keywordLocation": "/items/$ref/required",
    +          "absoluteKeywordLocation":
    +            "https://example.com/polygon#/$defs/point/required",
    +          "instanceLocation": "/1",
    +          "error": "Required property 'y' not found."
    +        },
    +        {
    +          "valid": false,
    +          "keywordLocation": "/items/$ref/additionalProperties",
    +          "absoluteKeywordLocation":
    +            "https://example.com/polygon#/$defs/point/additionalProperties",
    +          "instanceLocation": "/1/z",
    +          "error": "Additional property 'z' found but was invalid."
    +        }
    +      ]
    +    },
    +    {
    +      "valid": false,
    +      "keywordLocation": "/minItems",
    +      "instanceLocation": "",
    +      "error": "Expected at least 3 items but found 2"
    +    }
    +  ]
    +}
    +
    +
    +
    +
    +
    +

    +12.4.4. Verbose +

    +

    + The "Verbose" structure is a fully realized hierarchy that exactly matches + that of the schema. This structure has applications in form generation and + validation where the error's location is important.

    +

    + The primary difference between this and the "Detailed" structure is that + all results are returned. This includes sub-schema validation results that + would otherwise be removed (e.g. annotations for failed validations, + successful validations inside a `not` keyword, etc.). Because of this, it + is RECOMMENDED that each node also carry a `valid` property to indicate the + validation result for that node.

    +

    + Because this output structure can be quite large, a smaller example is given + here for brevity. The URI of the full output structure of the example above is: + https://json-schema.org/draft/2020-12/output/verbose-example.

    +
    +
    +
    +// schema
    +{
    +  "$id": "https://example.com/polygon",
    +  "$schema": "https://json-schema.org/draft/2020-12/schema",
    +  "type": "object",
    +  "properties": {
    +    "validProp": true,
    +  },
    +  "additionalProperties": false
    +}
    +
    +// instance
    +{
    +  "validProp": 5,
    +  "disallowedProp": "value"
    +}
    +
    +// result
    +{
    +  "valid": false,
    +  "keywordLocation": "",
    +  "instanceLocation": "",
    +  "errors": [
    +    {
    +      "valid": true,
    +      "keywordLocation": "/type",
    +      "instanceLocation": ""
    +    },
    +    {
    +      "valid": true,
    +      "keywordLocation": "/properties",
    +      "instanceLocation": ""
    +    },
    +    {
    +      "valid": false,
    +      "keywordLocation": "/additionalProperties",
    +      "instanceLocation": "",
    +      "errors": [
    +        {
    +          "valid": false,
    +          "keywordLocation": "/additionalProperties",
    +          "instanceLocation": "/disallowedProp",
    +          "error": "Additional property 'disallowedProp' found but was invalid."
    +        }
    +      ]
    +    }
    +  ]
    +}
    +
    +
    +
    +
    +
    +

    +12.4.5. Output validation schemas +

    +

    + For convenience, JSON Schema has been provided to validate output generated + by implementations. Its URI is: + https://json-schema.org/draft/2020-12/output/schema.

    +
    +
    +
    +
    +
    +
    +

    +13. Security Considerations +

    +

    + Both schemas and instances are JSON values. As such, all security considerations + defined in RFC 8259 [RFC8259] apply.

    +

    + Instances and schemas are both frequently written by untrusted third parties, to be + deployed on public Internet servers. + Validators should take care that the parsing and validating against schemas does not consume excessive + system resources. + Validators MUST NOT fall into an infinite loop.

    +

    + A malicious party could cause an implementation to repeatedly collect a copy + of a very large value as an annotation. Implementations SHOULD guard against + excessive consumption of system resources in such a scenario.

    +

    + Servers MUST ensure that malicious parties cannot change the functionality of + existing schemas by uploading a schema with a pre-existing or very similar "$id".

    +

    + Individual JSON Schema vocabularies are liable to also have their own security + considerations. Consult the respective specifications for more information.

    +

    + Schema authors should take care with "$comment" contents, as a malicious + implementation can display them to end-users in violation of a spec, or + fail to strip them if such behavior is expected.

    +

    + A malicious schema author could place executable code or other dangerous + material within a "$comment". Implementations MUST NOT parse or otherwise + take action based on "$comment" contents.

    +
    +
    +
    +

    +14. IANA Considerations +

    +
    +

    +14.1. application/schema+json +

    +

    + The proposed MIME media type for JSON Schema is defined as follows:

    +
      +
    • Type name: application +
    • +
    • Subtype name: schema+json +
    • +
    • Required parameters: N/A +
    • +
    • + Encoding considerations: Encoding considerations are + identical to those specified for the "application/json" + media type. See JSON [RFC8259]. +
    • +
    • + Security considerations: See Section + 13 above. +
    • +
    • + Interoperability considerations: See Sections + 6.2, + 6.3, and + 6.4 above. +
    • +
    • + Fragment identifier considerations: See Section + 5 +
    • +
    +
    +
    +

    +14.2. application/schema-instance+json +

    +

    + The proposed MIME media type for JSON Schema Instances that require + a JSON Schema-specific media type is defined as follows:

    +
      +
    • Type name: application +
    • +
    • Subtype name: schema-instance+json +
    • +
    • Required parameters: N/A +
    • +
    • + Encoding considerations: Encoding considerations are + identical to those specified for the "application/json" + media type. See JSON [RFC8259]. +
    • +
    • + Security considerations: See Section + 13 above. +
    • +
    • + Interoperability considerations: See Sections + 6.2, + 6.3, and + 6.4 above. +
    • +
    • + Fragment identifier considerations: See Section + 5 +
    • +
    +
    +
    +
    +

    +15. References +

    +
    +

    +15.1. Normative References +

    +
    +
    [RFC2119]
    +
    +Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/info/rfc2119>.
    +
    +
    [RFC3986]
    +
    +Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, DOI 10.17487/RFC3986, , <https://www.rfc-editor.org/info/rfc3986>.
    +
    +
    [RFC6839]
    +
    +Hansen, T. and A. Melnikov, "Additional Media Type Structured Syntax Suffixes", RFC 6839, DOI 10.17487/RFC6839, , <https://www.rfc-editor.org/info/rfc6839>.
    +
    +
    [RFC6901]
    +
    +Bryan, P., Ed., Zyp, K., and M. Nottingham, Ed., "JavaScript Object Notation (JSON) Pointer", RFC 6901, DOI 10.17487/RFC6901, , <https://www.rfc-editor.org/info/rfc6901>.
    +
    +
    [RFC8259]
    +
    +Bray, T., Ed., "The JavaScript Object Notation (JSON) Data Interchange Format", STD 90, RFC 8259, DOI 10.17487/RFC8259, , <https://www.rfc-editor.org/info/rfc8259>.
    +
    +
    [W3C.REC-ldp-20150226]
    +
    +Speicher, S., Arwe, J., and A. Malhotra, "Linked Data Platform 1.0", World Wide Web Consortium Recommendation REC-ldp-20150226, , <https://www.w3.org/TR/2015/REC-ldp-20150226>.
    +
    +
    [ecma262]
    +
    +"ECMA-262, 11th edition specification", , <https://www.ecma-international.org/ecma-262/11.0/index.html>.
    +
    +
    +
    +
    +

    +15.2. Informative References +

    +
    +
    [RFC6596]
    +
    +Ohye, M. and J. Kupke, "The Canonical Link Relation", RFC 6596, DOI 10.17487/RFC6596, , <https://www.rfc-editor.org/info/rfc6596>.
    +
    +
    [RFC7049]
    +
    +Bormann, C. and P. Hoffman, "Concise Binary Object Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, , <https://www.rfc-editor.org/info/rfc7049>.
    +
    +
    [RFC7231]
    +
    +Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content", RFC 7231, DOI 10.17487/RFC7231, , <https://www.rfc-editor.org/info/rfc7231>.
    +
    +
    [RFC8288]
    +
    +Nottingham, M., "Web Linking", RFC 8288, DOI 10.17487/RFC8288, , <https://www.rfc-editor.org/info/rfc8288>.
    +
    +
    [W3C.WD-fragid-best-practices-20121025]
    +
    +Tennison, J., "Best Practices for Fragment Identifiers and Media Type Definitions", World Wide Web Consortium WD WD-fragid-best-practices-20121025, , <https://www.w3.org/TR/2012/WD-fragid-best-practices-20121025>.
    +
    +
    [json-schema-validation]
    +
    +Wright, A., Andrews, H., and B. Hutton, "JSON Schema Validation: A Vocabulary for Structural Validation of JSON", Work in Progress, Internet-Draft, draft-bhutton-json-schema-validation-01, , <https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-01>.
    +
    +
    [json-hyper-schema]
    +
    +Andrews, H. and A. Wright, "JSON Hyper-Schema: A Vocabulary for Hypermedia Annotation of JSON", Work in Progress, Internet-Draft, draft-handrews-json-schema-hyperschema-02, , <https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-hyperschema-02>.
    +
    +
    [xml-names]
    +
    +Bray, T., Ed., Hollander, D., Ed., Layman, A., Ed., and R. Tobin, Ed., "Namespaces in XML 1.1 (Second Edition)", , <http://www.w3.org/TR/2006/REC-xml-names11-20060816>.
    +
    +
    +
    +
    +
    +
    +

    +Appendix A. Schema identification examples +

    +

    + Consider the following schema, which shows "$id" being used to identify + both the root schema and various subschemas, and "$anchor" being used + to define plain name fragment identifiers.

    +
    +
    +
    +{
    +    "$id": "https://example.com/root.json",
    +    "$defs": {
    +        "A": { "$anchor": "foo" },
    +        "B": {
    +            "$id": "other.json",
    +            "$defs": {
    +                "X": { "$anchor": "bar" },
    +                "Y": {
    +                    "$id": "t/inner.json",
    +                    "$anchor": "bar"
    +                }
    +            }
    +        },
    +        "C": {
    +            "$id": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f"
    +        }
    +    }
    +}
    +
    +
    +
    +

    + The schemas at the following URI-encoded JSON + Pointers [RFC6901] (relative to the root schema) have the following + base URIs, and are identifiable by any listed URI in accordance with + sections 5 and + 9.2.1 above.

    +
    +
    # (document root)
    +
    +
    +
    canonical (and base) URI
    +
    + https://example.com/root.json +
    +
    +
    canonical resource URI plus pointer fragment
    +
    + https://example.com/root.json# +
    +
    +
    +
    +
    +
    #/$defs/A
    +
    +
    +
    base URI
    +
    https://example.com/root.json +
    +
    +
    canonical resource URI plus plain fragment
    +
    + https://example.com/root.json#foo +
    +
    +
    canonical resource URI plus pointer fragment
    +
    + https://example.com/root.json#/$defs/A +
    +
    +
    +
    +
    +
    #/$defs/B
    +
    +
    +
    canonical (and base) URI
    +
    https://example.com/other.json +
    +
    +
    canonical resource URI plus pointer fragment
    +
    + https://example.com/other.json# +
    +
    +
    base URI of enclosing (root.json) resource plus fragment
    +
    + https://example.com/root.json#/$defs/B +
    +
    +
    +
    +
    +
    #/$defs/B/$defs/X
    +
    +
    +
    base URI
    +
    https://example.com/other.json +
    +
    +
    canonical resource URI plus plain fragment
    +
    + https://example.com/other.json#bar +
    +
    +
    canonical resource URI plus pointer fragment
    +
    + https://example.com/other.json#/$defs/X +
    +
    +
    base URI of enclosing (root.json) resource plus fragment
    +
    + https://example.com/root.json#/$defs/B/$defs/X +
    +
    +
    +
    +
    +
    #/$defs/B/$defs/Y
    +
    +
    +
    canonical (and base) URI
    +
    https://example.com/t/inner.json +
    +
    +
    canonical URI plus plain fragment
    +
    + https://example.com/t/inner.json#bar +
    +
    +
    canonical URI plus pointer fragment
    +
    + https://example.com/t/inner.json# +
    +
    +
    base URI of enclosing (other.json) resource plus fragment
    +
    + https://example.com/other.json#/$defs/Y +
    +
    +
    base URI of enclosing (root.json) resource plus fragment
    +
    + https://example.com/root.json#/$defs/B/$defs/Y +
    +
    +
    +
    +
    +
    #/$defs/C
    +
    +
    +
    canonical (and base) URI
    +
    + urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f +
    +
    +
    canonical URI plus pointer fragment
    +
    + urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f# +
    +
    +
    base URI of enclosing (root.json) resource plus fragment
    +
    + https://example.com/root.json#/$defs/C +
    +
    +
    +
    +
    +
    +

    + Note: The fragment part of the URI does not make it canonical or non-canonical, + rather, the base URI used (as part of the full URI with any fragment) is what + determines the canonical nature of the resulting full URI. + + Multiple "canonical" URIs? We Acknowledge this is potentially confusing, and + direct you to read the CREF located in the + JSON Pointer fragments and embedded schema resources (Section 9.2.1) + section for futher comments. +

    +
    +
    +
    +

    +Appendix B. Manipulating schema documents and references +

    +

    + Various tools have been created to rearrange schema documents + based on how and where references ("$ref") appear. This appendix discusses + which use cases and actions are compliant with this specification.

    +
    +

    +B.1. Bundling schema resources into a single document +

    +

    + A set of schema resources intended for use together can be organized + with each in its own schema document, all in the same schema document, + or any granularity of document grouping in between.

    +

    + Numerous tools exist to perform various sorts of reference removal. + A common case of this is producing a single file where all references + can be resolved within that file. This is typically done to simplify + distribution, or to simplify coding so that various invocations + of JSON Schema libraries do not have to keep track of and load + a large number of resources.

    +

    + This transformation can be safely and reversibly done as long as + all static references (e.g. "$ref") use URI-references that resolve + to URIs using the canonical resource URI as the base, and all schema + resources have an absolute-URI as the "$id" in their root schema.

    +

    + With these conditions met, each external resource can be copied + under "$defs", without breaking any references among the resources' + schema objects, and without changing any aspect of validation or + annotation results. The names of the schemas under "$defs" do + not affect behavior, assuming they are each unique, as they + do not appear in the canonical URIs for the embedded resources.

    +
    +
    +

    +B.2. Reference removal is not always safe +

    +

    + Attempting to remove all references and produce a single schema document does not, + in all cases, produce a schema with identical behavior to the original form.

    +

    + Since "$ref" is now treated like any other keyword, with other keywords allowed + in the same schema objects, fully supporting non-recursive "$ref" removal in + all cases can require relatively complex schema manipulations. It is beyond + the scope of this specification to determine or provide a set of safe "$ref" + removal transformations, as they depend not only on the schema structure + but also on the intended usage.

    +
    +
    +
    +
    +

    +Appendix C. Example of recursive schema extension +

    +

    + Consider the following two schemas describing a simple + recursive tree structure, where each node in the tree + can have a "data" field of any type. The first schema + allows and ignores other instance properties. The second is + more strict and only allows the "data" and "children" properties. + An example instance with "data" misspelled as "daat" is also shown.

    +
    +
    +
    +// tree schema, extensible
    +{
    +    "$schema": "https://json-schema.org/draft/2020-12/schema",
    +    "$id": "https://example.com/tree",
    +    "$dynamicAnchor": "node",
    +
    +    "type": "object",
    +    "properties": {
    +        "data": true,
    +        "children": {
    +            "type": "array",
    +            "items": {
    +                "$dynamicRef": "#node"
    +            }
    +        }
    +    }
    +}
    +
    +// strict-tree schema, guards against misspelled properties
    +{
    +    "$schema": "https://json-schema.org/draft/2020-12/schema",
    +    "$id": "https://example.com/strict-tree",
    +    "$dynamicAnchor": "node",
    +
    +    "$ref": "tree",
    +    "unevaluatedProperties": false
    +}
    +
    +// instance with misspelled field
    +{
    +    "children": [ { "daat": 1 } ]
    +}
    +
    +
    +
    +

    + When we load these two schemas, we will notice the "$dynamicAnchor" + named "node" (note the lack of "#" as this is just the name) + present in each, resulting in the following full schema URIs:

    +
      +
    • "https://example.com/tree#node" +
    • +
    • "https://example.com/strict-tree#node" +
    • +
    +

    + In addition, JSON Schema implementations keep track of the fact + that these fragments were created with "$dynamicAnchor".

    +

    + If we apply the "strict-tree" schema to the instance, we will follow + the "$ref" to the "tree" schema, examine its "children" subschema, + and find the "$dynamicRef": to "#node" (note the "#" for URI fragment syntax) + in its "items" subschema. That reference resolves to + "https://example.com/tree#node", which is a URI with a fragment + created by "$dynamicAnchor". Therefore we must examine the dynamic + scope before following the reference.

    +

    + At this point, the dynamic path is + "#/$ref/properties/children/items/$dynamicRef", with a dynamic scope + containing (from the outermost scope to the innermost):

    +
      +
    1. "https://example.com/strict-tree#" +
    2. +
    3. "https://example.com/tree#" +
    4. +
    5. "https://example.com/tree#/properties/children" +
    6. +
    7. "https://example.com/tree#/properties/children/items" +
    8. +
    +

    + Since we are looking for a plain name fragment, which can be + defined anywhere within a schema resource, the JSON Pointer fragments + are irrelevant to this check. That means that we can remove those + fragments and eliminate consecutive duplicates, producing:

    +
      +
    1. "https://example.com/strict-tree" +
    2. +
    3. "https://example.com/tree" +
    4. +
    +

    + In this case, the outermost resource also has a "node" fragment + defined by "$dynamicAnchor". Therefore instead of resolving the + "$dynamicRef" to "https://example.com/tree#node", we resolve it to + "https://example.com/strict-tree#node".

    +

    + This way, the recursion in the "tree" schema recurses to the root + of "strict-tree", instead of only applying "strict-tree" to the + instance root, but applying "tree" to instance children.

    +

    + This example shows both "$dynamicAnchor"s in the same place + in each schema, specifically the resource root schema. + Since plain-name fragments are independent of the JSON structure, + this would work just as well if one or both of the node schema objects + were moved under "$defs". It is the matching "$dynamicAnchor" values + which tell us how to resolve the dynamic reference, not any sort of + correlation in JSON structure.

    +
    +
    +
    +

    +Appendix D. Working with vocabularies +

    +
    +

    +D.1. Best practices for vocabulary and meta-schema authors +

    +

    + Vocabulary authors should + take care to avoid keyword name collisions if the vocabulary is intended + for broad use, and potentially combined with other vocabularies. JSON + Schema does not provide any formal namespacing system, but also does + not constrain keyword names, allowing for any number of namespacing + approaches.

    +

    + Vocabularies may build on each other, such as by defining the behavior + of their keywords with respect to the behavior of keywords from another + vocabulary, or by using a keyword from another vocabulary with + a restricted or expanded set of acceptable values. Not all such + vocabulary re-use will result in a new vocabulary that is compatible + with the vocabulary on which it is built. Vocabulary authors should + clearly document what level of compatibility, if any, is expected.

    +

    + Meta-schema authors should not use "$vocabulary" to combine multiple + vocabularies that define conflicting syntax or semantics for the same + keyword. As semantic conflicts are not generally detectable through + schema validation, implementations are not expected to detect such + conflicts. If conflicting vocabularies are declared, the resulting + behavior is undefined.

    +

    + Vocabulary authors SHOULD provide a meta-schema that validates the + expected usage of the vocabulary's keywords on their own. Such meta-schemas + SHOULD not forbid additional keywords, and MUST not forbid any + keywords from the Core vocabulary.

    +

    + It is recommended that meta-schema authors reference each vocabulary's + meta-schema using the "allOf" (Section 10.2.1.1) keyword, + although other mechanisms for constructing the meta-schema may be + appropriate for certain use cases.

    +

    + The recursive nature of meta-schemas makes the "$dynamicAnchor" + and "$dynamicRef" keywords particularly useful for extending + existing meta-schemas, as can be seen in the JSON Hyper-Schema meta-schema + which extends the Validation meta-schema.

    +

    + Meta-schemas may impose additional constraints, including describing + keywords not present in any vocabulary, beyond what the meta-schemas + associated with the declared vocabularies describe. This allows for + restricting usage to a subset of a vocabulary, and for validating + locally defined keywords not intended for re-use.

    +

    + However, meta-schemas should not contradict any vocabularies that + they declare, such as by requiring a different JSON type than + the vocabulary expects. The resulting behavior is undefined.

    +

    + Meta-schemas intended for local use, with no need to test for + vocabulary support in arbitrary implementations, can safely omit + "$vocabulary" entirely.

    +
    +
    +
    +

    +D.2. Example meta-schema with vocabulary declarations +

    +

    + This meta-schema explicitly declares both the Core and Applicator vocabularies, + together with an extension vocabulary, and combines their meta-schemas with + an "allOf". The extension vocabulary's meta-schema, which describes only the + keywords in that vocabulary, is shown after the main example meta-schema.

    +

    + The main example meta-schema also restricts the usage of the Unevaluated + vocabulary by forbidding the keywords prefixed with "unevaluated", which + are particularly complex to implement. This does not change the semantics + or set of keywords defined by the other vocabularies. It just ensures + that schemas using this meta-schema that attempt to use the keywords + prefixed with "unevaluated" will fail validation against this meta-schema.

    +

    + Finally, this meta-schema describes the syntax of a keyword, "localKeyword", + that is not part of any vocabulary. Presumably, the implementors and users + of this meta-schema will understand the semantics of "localKeyword". + JSON Schema does not define any mechanism for expressing keyword semantics + outside of vocabularies, making them unsuitable for use except in a + specific environment in which they are understood.

    +

    + This meta-schema combines several vocabularies for general use.

    +
    +
    +
    +{
    +  "$schema": "https://json-schema.org/draft/2020-12/schema",
    +  "$id": "https://example.com/meta/general-use-example",
    +  "$dynamicAnchor": "meta",
    +  "$vocabulary": {
    +    "https://json-schema.org/draft/2020-12/vocab/core": true,
    +    "https://json-schema.org/draft/2020-12/vocab/applicator": true,
    +    "https://json-schema.org/draft/2020-12/vocab/validation": true,
    +    "https://example.com/vocab/example-vocab": true
    +  },
    +  "allOf": [
    +    {"$ref": "https://json-schema.org/draft/2020-12/meta/core"},
    +    {"$ref": "https://json-schema.org/draft/2020-12/meta/applicator"},
    +    {"$ref": "https://json-schema.org/draft/2020-12/meta/validation"},
    +    {"$ref": "https://example.com/meta/example-vocab"}
    +  ],
    +  "patternProperties": {
    +    "^unevaluated": false
    +  },
    +  "properties": {
    +    "localKeyword": {
    +      "$comment": "Not in vocabulary, but validated if used",
    +      "type": "string"
    +    }
    +  }
    +}
    +
    +
    +
    +

    + This meta-schema describes only a single extension vocabulary.

    +
    +
    +
    +{
    +  "$schema": "https://json-schema.org/draft/2020-12/schema",
    +  "$id": "https://example.com/meta/example-vocab",
    +  "$dynamicAnchor": "meta",
    +  "$vocabulary": {
    +    "https://example.com/vocab/example-vocab": true,
    +  },
    +  "type": ["object", "boolean"],
    +  "properties": {
    +    "minDate": {
    +      "type": "string",
    +      "pattern": "\d\d\d\d-\d\d-\d\d",
    +      "format": "date",
    +    }
    +  }
    +}
    +
    +
    +
    +

    + As shown above, even though each of the single-vocabulary meta-schemas + referenced in the general-use meta-schema's "allOf" declares its + corresponding vocabulary, this new meta-schema must re-declare them.

    +

    + The standard meta-schemas that combine all vocabularies defined by + the Core and Validation specification, and that combine all vocabularies + defined by those specifications as well as the Hyper-Schema specification, + demonstrate additional complex combinations. These URIs for these + meta-schemas may be found in the Validation and Hyper-Schema specifications, + respectively.

    +

    + While the general-use meta-schema can validate the syntax of "minDate", + it is the vocabulary that defines the logic behind the semantic meaning + of "minDate". Without an understanding of the semantics (in this example, + that the instance value must be a date equal to or after the date + provided as the keyword's value in the schema), an implementation can + only validate the syntactic usage. In this case, that means validating + that it is a date-formatted string (using "pattern" to ensure that it is + validated even when "format" functions purely as an annotation, as explained + in the Validation specification [json-schema-validation].

    +
    +
    +
    +
    +

    +Appendix E. References and generative use cases +

    +

    + While the presence of references is expected to be transparent + to validation results, generative use cases such as code generators + and UI renderers often consider references to be semantically significant.

    +

    + To make such use case-specific semantics explicit, the best practice + is to create an annotation keyword for use in the same + schema object alongside of a reference keyword such as "$ref".

    +

    + For example, here is a hypothetical keyword for determining + whether a code generator should consider the reference + target to be a distinct class, and how those classes are related. + Note that this example is solely for illustrative purposes, and is + not intended to propose a functional code generation keyword.

    +
    +
    +
    +{
    +    "allOf": [
    +        {
    +            "classRelation": "is-a",
    +            "$ref": "classes/base.json"
    +        },
    +        {
    +            "$ref": "fields/common.json"
    +        }
    +    ],
    +    "properties": {
    +        "foo": {
    +            "classRelation": "has-a",
    +            "$ref": "classes/foo.json"
    +        },
    +        "date": {
    +            "$ref": "types/dateStruct.json",
    +        }
    +    }
    +}
    +
    +
    +
    +

    + Here, this schema represents some sort of object-oriented class. + The first reference in the "allOf" is noted as the base class. + The second is not assigned a class relationship, meaning that the + code generator should combine the target's definition with this + one as if no reference were involved.

    +

    + Looking at the properties, "foo" is flagged as object composition, + while the "date" property is not. It is simply a field with + sub-fields, rather than an instance of a distinct class.

    +

    + This style of usage requires the annotation to be in the same object + as the reference, which must be recognizable as a reference.

    +
    +
    +

    +Appendix F. Acknowledgments +

    +

    + Thanks to + Gary Court, + Francis Galiegue, + Kris Zyp, + and Geraint Luff + for their work on the initial drafts of JSON Schema.

    +

    + Thanks to + Jason Desrosiers, + Daniel Perrett, + Erik Wilde, + Evgeny Poberezkin, + Brad Bowman, + Gowry Sankar, + Donald Pipowitch, + Dave Finlay, + Denis Laxalde, + Phil Sturgeon, + Shawn Silverman, + and Karen Etheridge + for their submissions and patches to the document.

    +
    +
    +

    +Appendix G. ChangeLog +

    +

    + This section to be removed before leaving Internet-Draft status.

    +
    +
    draft-bhutton-json-schema-01
    +
    +
      +
    • Improve and clarify the "type", "contains", "unevaluatedProperties", and "unevaluatedItems" keyword explanations +
    • +
    • Clarify various aspects of "canonical URIs" +
    • +
    • Comment on ambiguity around annotations and "additionalProperties" +
    • +
    • Clarify Vocabularies need not be formally defined +
    • +
    • Remove references to remaining media-type parameters +
    • +
    • Fix multiple examples +
    • +
    +
    +
    +
    draft-bhutton-json-schema-00
    +
    +
      +
    • "$schema" MAY change for embedded resources +
    • +
    • Array-value "items" functionality is now "prefixItems" +
    • +
    • "items" subsumes the old function of "additionalItems" +
    • +
    • "contains" annotation behavior, and "contains" and "unevaluatedItems" interactions now specified +
    • +
    • Rename $recursive* to $dynamic*, with behavior modification +
    • +
    • $dynamicAnchor defines a fragment like $anchor +
    • +
    • $dynamic* (previously $recursive) no longer use runtime base URI determination +
    • +
    • Define Compound Schema Documents (bundle) and processing +
    • +
    • Reference ECMA-262, 11th edition for regular expression support +
    • +
    • Regular expression should support unicode +
    • +
    • Remove media type parameters +
    • +
    • Specify Unknown keywords are collected as annotations +
    • +
    • Moved "unevaluatedItems" and "unevaluatedProperties" from core into their own vocabulary +
    • +
    +
    +
    +
    draft-handrews-json-schema-02
    +
    +
      +
    • Update to RFC 8259 for JSON specification +
    • +
    • Moved "definitions" from the Validation specification here as "$defs" +
    • +
    • Moved applicator keywords from the Validation specification as their own vocabulary +
    • +
    • Moved the schema form of "dependencies" from the Validation specification as "dependentSchemas" +
    • +
    • Formalized annotation collection +
    • +
    • Specified recommended output formats +
    • +
    • Defined keyword interactions in terms of annotation and assertion results +
    • +
    • Added "unevaluatedProperties" and "unevaluatedItems" +
    • +
    • Define "$ref" behavior in terms of the assertion, applicator, and annotation model +
    • +
    • Allow keywords adjacent to "$ref" +
    • +
    • Note undefined behavior for "$ref" targets involving unknown keywords +
    • +
    • Add recursive referencing, primarily for meta-schema extension +
    • +
    • Add the concept of formal vocabularies, and how they can be recognized through meta-schemas +
    • +
    • Additional guidance on initial base URIs beyond network retrieval +
    • +
    • Allow "schema" media type parameter for "application/schema+json" +
    • +
    • Better explanation of media type parameters and the HTTP Accept header +
    • +
    • Use "$id" to establish canonical and base absolute-URIs only, no fragments +
    • +
    • Replace plain-name-fragment-only form of "$id" with "$anchor" +
    • +
    • Clarified that the behavior of JSON Pointers across "$id" boundary is unreliable +
    • +
    +
    +
    +
    draft-handrews-json-schema-01
    +
    +
      +
    • This draft is purely a clarification with no functional changes +
    • +
    • Emphasized annotations as a primary usage of JSON Schema +
    • +
    • Clarified $id by use cases +
    • +
    • Exhaustive schema identification examples +
    • +
    • Replaced "external referencing" with how and when an implementation might know of a schema from another document +
    • +
    • Replaced "internal referencing" with how an implementation should recognized schema identifiers during parsing +
    • +
    • Dereferencing the former "internal" or "external" references is always the same process +
    • +
    • Minor formatting improvements +
    • +
    +
    +
    +
    draft-handrews-json-schema-00
    +
    +
      +
    • Make the concept of a schema keyword vocabulary more clear +
    • +
    • Note that the concept of "integer" is from a vocabulary, not the data model +
    • +
    • Classify keywords as assertions or annotations and describe their general behavior +
    • +
    • Explain the boolean schemas in terms of generalized assertions +
    • +
    • Reserve "$comment" for non-user-visible notes about the schema +
    • +
    • Wording improvements around "$id" and fragments +
    • +
    • Note the challenges of extending meta-schemas with recursive references +
    • +
    • Add "application/schema-instance+json" media type +
    • +
    • Recommend a "schema" link relation / parameter instead of "profile" +
    • +
    +
    +
    +
    draft-wright-json-schema-01
    +
    +
      +
    • Updated intro +
    • +
    • Allowed for any schema to be a boolean +
    • +
    • "$schema" SHOULD NOT appear in subschemas, although that may change +
    • +
    • Changed "id" to "$id"; all core keywords prefixed with "$" +
    • +
    • Clarify and formalize fragments for application/schema+json +
    • +
    • Note applicability to formats such as CBOR that can be represented in the JSON data model +
    • +
    +
    +
    +
    draft-wright-json-schema-00
    +
    +
      +
    • Updated references to JSON +
    • +
    • Updated references to HTTP +
    • +
    • Updated references to JSON Pointer +
    • +
    • Behavior for "id" is now specified in terms of RFC3986 +
    • +
    • Aligned vocabulary usage for URIs with RFC3986 +
    • +
    • Removed reference to draft-pbryan-zyp-json-ref-03 +
    • +
    • Limited use of "$ref" to wherever a schema is expected +
    • +
    • Added definition of the "JSON Schema data model" +
    • +
    • Added additional security considerations +
    • +
    • Defined use of subschema identifiers for "id" +
    • +
    • Rewrote section on usage with HTTP +
    • +
    • Rewrote section on usage with rel="describedBy" and rel="profile" +
    • +
    • Fixed numerous invalid examples +
    • +
    +
    +
    +
    draft-zyp-json-schema-04
    +
    +
      +
    • Salvaged from draft v3. +
    • +
    • Split validation keywords into separate document. +
    • +
    • Split hypermedia keywords into separate document. +
    • +
    • Initial post-split draft. +
    • +
    • Mandate the use of JSON Reference, JSON Pointer. +
    • +
    • Define the role of "id". Define URI resolution scope. +
    • +
    • Add interoperability considerations. +
    • +
    +
    +
    +
    draft-zyp-json-schema-00
    +
    +
      +
    • Initial draft. +
    • +
    +
    +
    +
    +
    +
    +
    +

    +Authors' Addresses +

    +
    +
    Austin Wright (editor)
    + +
    +
    +
    Henry Andrews (editor)
    + +
    +
    +
    Ben Hutton (editor)
    +
    Postman
    + + +
    +
    +
    Greg Dennis
    + + +
    +
    +
    + + + diff --git a/draft/2020-12/json-schema-validation.html b/draft/2020-12/json-schema-validation.html new file mode 100644 index 00000000..82d22aad --- /dev/null +++ b/draft/2020-12/json-schema-validation.html @@ -0,0 +1,3185 @@ + + + + + + +JSON Schema Validation: A Vocabulary for Structural Validation of JSON + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Internet-DraftJSON Schema ValidationJune 2022
    Wright, et al.Expires 18 December 2022[Page]
    +
    +
    +
    +
    Workgroup:
    +
    Internet Engineering Task Force
    +
    Internet-Draft:
    +
    draft-bhutton-json-schema-validation-01
    +
    Published:
    +
    + +
    +
    Intended Status:
    +
    Informational
    +
    Expires:
    +
    +
    Authors:
    +
    +
    +
    A. Wright, Ed. +
    +
    +
    +
    H. Andrews, Ed. +
    +
    +
    +
    B. Hutton, Ed. +
    +
    Postman
    +
    +
    +
    +
    +

    JSON Schema Validation: A Vocabulary for Structural Validation of JSON

    +
    +

    Abstract

    +

    + JSON Schema (application/schema+json) has several purposes, one of which is JSON + instance validation. + This document specifies a vocabulary for JSON Schema to describe the meaning of JSON + documents, provide hints for user interfaces working with JSON data, and to make + assertions about what a valid document must look like.

    +
    +
    +

    +Note to Readers +

    +

    + The issues list for this draft can be found at + https://github.com/json-schema-org/json-schema-spec/issues.

    +

    + For additional information, see https://json-schema.org/.

    +

    + To provide feedback, use this issue tracker, the communication methods listed on the + homepage, or email the document editors.

    +
    +
    +
    +

    +Status of This Memo +

    +

    + This Internet-Draft is submitted in full conformance with the + provisions of BCP 78 and BCP 79.

    +

    + Internet-Drafts are working documents of the Internet Engineering Task + Force (IETF). Note that other groups may also distribute working + documents as Internet-Drafts. The list of current Internet-Drafts is + at https://datatracker.ietf.org/drafts/current/.

    +

    + Internet-Drafts are draft documents valid for a maximum of six months + and may be updated, replaced, or obsoleted by other documents at any + time. It is inappropriate to use Internet-Drafts as reference + material or to cite them other than as "work in progress."

    +

    + This Internet-Draft will expire on 18 December 2022.

    +
    +
    + +
    +
    +

    +Table of Contents +

    + +
    +
    +
    +

    +1. Introduction +

    +

    + JSON Schema can be used to require that a given JSON document (an instance) + satisfies a certain number of criteria. These criteria are asserted by using + keywords described in this specification. In addition, a set of keywords + is also defined to assist in interactive user interface instance generation.

    +

    + This specification will use the concepts, syntax, and terminology defined + by the JSON Schema core [json-schema] specification.

    +
    +
    +

    +2. Conventions and Terminology +

    +

    + + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", + "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be + interpreted as described in RFC 2119 [RFC2119].

    +

    + This specification uses the term "container instance" to refer to both array and + object instances. It uses the term "children instances" to refer to array elements + or object member values.

    +

    + Elements in an array value are said to be unique if no two elements of this array + are equal [json-schema].

    +
    +
    +

    +3. Overview +

    +

    + JSON Schema validation asserts constraints on the structure of instance data. + An instance location that satisfies all asserted constraints is then + annotated with any keywords that contain non-assertion information, + such as descriptive metadata and usage hints. If all locations within + the instance satisfy all asserted constraints, then the instance is + said to be valid against the schema.

    +

    + Each schema object is independently evaluated against each instance location + to which it applies. This greatly simplifies the implementation requirements + for validators by ensuring that they do not need to maintain state across + the document-wide validation process.

    +

    + This specification defines a set of assertion keywords, as well as a small vocabulary + of metadata keywords that can be used to annotate the JSON instance with + useful information. The Section 7 keyword is intended primarily + as an annotation, but can optionally be used as an assertion. The + Section 8 keywords are annotations for working with documents + embedded as JSON strings.

    +
    +
    +

    +4. Interoperability Considerations +

    +
    +

    +4.1. Validation of String Instances +

    +

    + It should be noted that the nul character (\u0000) is valid in a JSON string. An + instance to validate may contain a string value with this character, regardless + of the ability of the underlying programming language to deal with such data.

    +
    +
    +

    +4.2. Validation of Numeric Instances +

    +

    + The JSON specification allows numbers with arbitrary precision, and JSON Schema + does not add any such bounds. + This means that numeric instances processed by JSON Schema can be arbitrarily large and/or + have an arbitrarily long decimal part, regardless of the ability of the + underlying programming language to deal with such data.

    +
    +
    +
    +

    +4.3. Regular Expressions +

    +

    + Keywords that use regular expressions, or constrain the instance value + to be a regular expression, are subject to the interoperability + considerations for regular expressions in the + JSON Schema Core [json-schema] specification.

    +
    +
    +
    +
    +
    +

    +5. Meta-Schema +

    +

    + The current URI for the default JSON Schema dialect meta-schema is + https://json-schema.org/draft/2020-12/schema. + For schema author convenience, this meta-schema describes a dialect + consisting of all vocabularies + defined in this specification and the JSON Schema Core specification, + as well as two former keywords which are reserved for a transitional period. + Individual vocabulary and vocabulary meta-schema URIs are given for + each section below. Certain vocabularies are optional to support, which + is explained in detail in the relevant sections.

    +

    + Updated vocabulary and meta-schema URIs MAY be published between + specification drafts in order to correct errors. Implementations + SHOULD consider URIs dated after this specification draft and + before the next to indicate the same syntax and semantics + as those listed here.

    +
    +
    +
    +

    +6. A Vocabulary for Structural Validation +

    +

    + Validation keywords in a schema impose requirements for successful validation of an + instance. These keywords are all assertions without any annotation behavior.

    +

    + Meta-schemas that do not use "$vocabulary" SHOULD be considered to + require this vocabulary as if its URI were present with a value of true.

    +

    + The current URI for this vocabulary, known as the Validation vocabulary, is: + <https://json-schema.org/draft/2020-12/vocab/validation>.

    +

    + The current URI for the corresponding meta-schema is: + https://json-schema.org/draft/2020-12/meta/validation.

    +
    +
    +

    +6.1. Validation Keywords for Any Instance Type +

    +
    +

    +6.1.1. type +

    +

    + The value of this keyword MUST be either a string or an array. If it is + an array, elements of the array MUST be strings and MUST be unique.

    +

    + String values MUST be one of the six primitive types + ("null", "boolean", "object", "array", "number", or "string"), + or "integer" which matches any number with a zero fractional part.

    +

    + If the value of "type" is a string, then an instance validates successfully if + its type matches the type represented by the value of the string. + + If the value of "type" is an array, then an instance validates successfully if + its type matches any of the types indicated by the strings in the array.

    +
    +
    +
    +

    +6.1.2. enum +

    +

    + The value of this keyword MUST be an array. This array SHOULD have at + least one element. Elements in the array SHOULD be unique.

    +

    + An instance validates successfully against this keyword if its value is + equal to one of the elements in this keyword's array value.

    +

    + Elements in the array might be of any type, including null.

    +
    +
    +
    +

    +6.1.3. const +

    +

    + The value of this keyword MAY be of any type, including null.

    +

    + Use of this keyword is functionally equivalent to an + "enum" (Section 6.1.2) with a single value.

    +

    + An instance validates successfully against this keyword if its value is + equal to the value of the keyword.

    +
    +
    +
    +
    +
    +

    +6.2. Validation Keywords for Numeric Instances (number and integer) +

    +
    +

    +6.2.1. multipleOf +

    +

    + The value of "multipleOf" MUST be a number, strictly greater than 0.

    +

    + A numeric instance is valid only if division by this keyword's value results in + an integer.

    +
    +
    +

    +6.2.2. maximum +

    +

    + The value of "maximum" MUST be a number, representing an inclusive upper limit + for a numeric instance.

    +

    + If the instance is a number, then this keyword validates only if the instance is + less than or exactly equal to "maximum".

    +
    +
    +

    +6.2.3. exclusiveMaximum +

    +

    + The value of "exclusiveMaximum" MUST be a number, representing an exclusive upper + limit for a numeric instance.

    +

    + If the instance is a number, then the instance is valid only if it has a value + strictly less than (not equal to) "exclusiveMaximum".

    +
    +
    +

    +6.2.4. minimum +

    +

    + The value of "minimum" MUST be a number, representing an inclusive lower limit + for a numeric instance.

    +

    + If the instance is a number, then this keyword validates only if the instance is + greater than or exactly equal to "minimum".

    +
    +
    +

    +6.2.5. exclusiveMinimum +

    +

    + The value of "exclusiveMinimum" MUST be a number, representing an exclusive lower + limit for a numeric instance.

    +

    + If the instance is a number, then the instance is valid only if it has a value + strictly greater than (not equal to) "exclusiveMinimum".

    +
    +
    +
    +
    +
    +

    +6.3. Validation Keywords for Strings +

    +
    +

    +6.3.1. maxLength +

    +

    + The value of this keyword MUST be a non-negative integer.

    +

    + A string instance is valid against this keyword if its + length is less than, or equal to, the value of this keyword.

    +

    + The length of a string instance is defined as the number of its + characters as defined by RFC 8259 [RFC8259].

    +
    +
    +

    +6.3.2. minLength +

    +

    + The value of this keyword MUST be a non-negative integer.

    +

    + A string instance is valid against this keyword if its + length is greater than, or equal to, the value of this keyword.

    +

    + The length of a string instance is defined as the number of its + characters as defined by RFC 8259 [RFC8259].

    +

    + Omitting this keyword has the same behavior as a value of 0.

    +
    +
    +
    +

    +6.3.3. pattern +

    +

    + The value of this keyword MUST be a string. This string SHOULD be a + valid regular expression, according to the ECMA-262 regular expression + dialect.

    +

    + A string instance is considered valid if the regular + expression matches the instance successfully. Recall: regular + expressions are not implicitly anchored.

    +
    +
    +
    +
    +
    +

    +6.4. Validation Keywords for Arrays +

    +
    +

    +6.4.1. maxItems +

    +

    + The value of this keyword MUST be a non-negative integer.

    +

    + An array instance is valid against "maxItems" if its size is + less than, or equal to, the value of this keyword.

    +
    +
    +

    +6.4.2. minItems +

    +

    + The value of this keyword MUST be a non-negative integer.

    +

    + An array instance is valid against "minItems" if its size is + greater than, or equal to, the value of this keyword.

    +

    + Omitting this keyword has the same behavior as a value of 0.

    +
    +
    +

    +6.4.3. uniqueItems +

    +

    + The value of this keyword MUST be a boolean.

    +

    + If this keyword has boolean value false, the instance validates + successfully. If it has boolean value true, the instance validates + successfully if all of its elements are unique.

    +

    + Omitting this keyword has the same behavior as a value of false.

    +
    +
    +

    +6.4.4. maxContains +

    +

    + The value of this keyword MUST be a non-negative integer.

    +

    + If "contains" is not present within the same schema object, + then this keyword has no effect.

    +

    + An instance array is valid against "maxContains" in two ways, depending on + the form of the annotation result of an adjacent + "contains" [json-schema] keyword. The first way is if + the annotation result is an array and the length of that array is less than + or equal to the "maxContains" value. The second way is if the annotation + result is a boolean "true" and the instance array length is less than or + equal to the "maxContains" value.

    +
    +
    +

    +6.4.5. minContains +

    +

    + The value of this keyword MUST be a non-negative integer.

    +

    + If "contains" is not present within the same schema object, + then this keyword has no effect.

    +

    + An instance array is valid against "minContains" in two ways, depending on + the form of the annotation result of an adjacent + "contains" [json-schema] keyword. The first way is if + the annotation result is an array and the length of that array is greater + than or equal to the "minContains" value. The second way is if the + annotation result is a boolean "true" and the instance array length is + greater than or equal to the "minContains" value.

    +

    + A value of 0 is allowed, but is only useful for setting a range + of occurrences from 0 to the value of "maxContains". A value of + 0 causes "minContains" and "contains" to always pass validation + (but validation can still fail against a "maxContains" keyword).

    +

    + Omitting this keyword has the same behavior as a value of 1.

    +
    +
    +
    +

    +6.5. Validation Keywords for Objects +

    +
    +

    +6.5.1. maxProperties +

    +

    + The value of this keyword MUST be a non-negative integer.

    +

    + An object instance is valid against "maxProperties" if its + number of properties is less than, or equal to, the value of this + keyword.

    +
    +
    +

    +6.5.2. minProperties +

    +

    + The value of this keyword MUST be a non-negative integer.

    +

    + An object instance is valid against "minProperties" if its + number of properties is greater than, or equal to, the value of this + keyword.

    +

    + Omitting this keyword has the same behavior as a value of 0.

    +
    +
    +

    +6.5.3. required +

    +

    + The value of this keyword MUST be an array. + Elements of this array, if any, MUST be strings, and MUST be unique.

    +

    + An object instance is valid against this keyword if every item in the array is + the name of a property in the instance.

    +

    + Omitting this keyword has the same behavior as an empty array.

    +
    +
    +

    +6.5.4. dependentRequired +

    +

    + The value of this keyword MUST be an object. Properties in + this object, if any, MUST be arrays. Elements in each array, + if any, MUST be strings, and MUST be unique.

    +

    + This keyword specifies properties that are required if a specific + other property is present. Their requirement is dependent on the + presence of the other property.

    +

    + Validation succeeds if, for each name that appears in both + the instance and as a name within this keyword's value, every + item in the corresponding array is also the name of a property + in the instance.

    +

    + Omitting this keyword has the same behavior as an empty object.

    +
    +
    +
    +
    +
    +

    +7. Vocabularies for Semantic Content With "format" +

    +
    +

    +7.1. Foreword +

    +

    + Structural validation alone may be insufficient to allow an application to correctly + utilize certain values. The "format" annotation keyword is defined to allow schema + authors to convey semantic information for a fixed subset of values which are + accurately described by authoritative resources, be they RFCs or other external + specifications.

    +

    + The value of this keyword is called a format attribute. It MUST be a string. A + format attribute can generally only validate a given set of instance types. If + the type of the instance to validate is not in this set, validation for this + format attribute and instance SHOULD succeed. All format attributes defined + in this section apply to strings, but a format attribute can be specified + to apply to any instance types defined in the data model defined in the + core JSON Schema. [json-schema] + + Note that the "type" keyword in this specification defines an "integer" type + which is not part of the data model. Therefore a format attribute can be + limited to numbers, but not specifically to integers. However, a numeric + format can be used alongside the "type" keyword with a value of "integer", + or could be explicitly defined to always pass if the number is not an integer, + which produces essentially the same behavior as only applying to integers. +

    +

    + The current URI for this vocabulary, known as the Format-Annotation vocabulary, is: + <https://json-schema.org/draft/2020-12/vocab/format-annotation>. The current + URI for the corresponding meta-schema is: + https://json-schema.org/draft/2020-12/meta/format-annotation. + Implementing support for this vocabulary is REQUIRED.

    +

    + In addition to the Format-Annotation vocabulary, a secondary vocabulary is available + for custom meta-schemas that defines "format" as an assertion. The URI for the + Format-Assertion vocabulary, is: + <https://json-schema.org/draft/2020-12/vocab/format-assertion>. The current + URI for the corresponding meta-schema is: + https://json-schema.org/draft/2020-12/meta/format-assertion. + Implementing support for the Format-Assertion vocabulary is OPTIONAL.

    +

    + Specifying both the Format-Annotation and the Format-Assertion vocabularies is functionally + equivalent to specifying only the Format-Assertion vocabulary since its requirements + are a superset of the Format-Annotation vocabulary.

    +
    +
    +

    +7.2. Implementation Requirements +

    +

    + The "format" keyword functions as defined by the vocabulary which is referenced.

    +
    +

    +7.2.1. Format-Annotation Vocabulary +

    +

    + The value of format MUST be collected as an annotation, if the implementation + supports annotation collection. This enables application-level validation when + schema validation is unavailable or inadequate.

    +

    + Implementations MAY still treat "format" as an assertion in addition to an + annotation and attempt to validate the value's conformance to the specified + semantics. The implementation MUST provide options to enable and disable such + evaluation and MUST be disabled by default. Implementations SHOULD document + their level of support for such validation. + + Specifying the Format-Annotation vocabulary and enabling validation in an + implementation should not be viewed as being equivalent to specifying + the Format-Assertion vocabulary since implementations are not required to + provide full validation support when the Format-Assertion vocabulary + is not specified. +

    +

    + When the implementation is configured for assertion behavior, it:

    +
      +
    • + SHOULD provide an implementation-specific best effort validation + for each format attribute defined below; +
    • +
    • + MAY choose to implement validation of any or all format attributes + as a no-op by always producing a validation result of true; +
    • +
    +

    + + This matches the current reality of implementations, which provide + widely varying levels of validation, including no validation at all, + for some or all format attributes. It is also designed to encourage + relying only on the annotation behavior and performing semantic + validation in the application, which is the recommended best practice. +

    +
    +
    +

    +7.2.2. Format-Assertion Vocabulary +

    +

    + When the Format-Assertion vocabulary is declared with a value of true, + implementations MUST provide full validation support for all of the formats + defined by this specificaion. Implementations that cannot provide full + validation support MUST refuse to process the schema.

    +

    + An implementation that supports the Format-Assertion vocabulary:

    +
      +
    • + MUST still collect "format" as an annotation if the implementation + supports annotation collection; +
    • +
    • + MUST evaluate "format" as an assertion; +
    • +
    • + MUST implement syntactic validation for all format attributes defined + in this specification, and for any additional format attributes that + it recognizes, such that there exist possible instance values + of the correct type that will fail validation. +
    • +
    +

    + The requirement for minimal validation of format attributes is intentionally + vague and permissive, due to the complexity involved in many of the attributes. + Note in particular that the requirement is limited to syntactic checking; it is + not to be expected that an implementation would send an email, attempt to connect + to a URL, or otherwise check the existence of an entity identified by a format + instance. + + The expectation is that for simple formats such as date-time, syntactic + validation will be thorough. For a complex format such as email addresses, + which are the amalgamation of various standards and numerous adjustments + over time, with obscure and/or obsolete rules that may or may not be + restricted by other applications making use of the value, a minimal validation + is sufficient. For example, an instance string that does not contain + an "@" is clearly not a valid email address, and an "email" or "hostname" + containing characters outside of 7-bit ASCII is likewise clearly invalid. +

    +

    + It is RECOMMENDED that implementations use a common parsing library for each format, + or a well-known regular expression. Implementations SHOULD clearly document + how and to what degree each format attribute is validated.

    +

    + The standard core and validation meta-schema (Section 5) + includes this vocabulary in its "$vocabulary" keyword with a value of false, + since by default implementations are not required to support this keyword + as an assertion. Supporting the format vocabulary with a value of true is + understood to greatly increase code size and in some cases execution time, + and will not be appropriate for all implementations.

    +
    +
    +

    +7.2.3. Custom format attributes +

    +

    + Implementations MAY support custom format attributes. Save for agreement between + parties, schema authors SHALL NOT expect a peer implementation to support such + custom format attributes. An implementation MUST NOT fail to collect unknown formats + as annotations. When the Format-Assertion vocabulary is specified, implementations + MUST fail upon encountering unknown formats.

    +

    + Vocabularies do not support specifically declaring different value sets for keywords. + Due to this limitation, and the historically uneven implementation of this keyword, + it is RECOMMENDED to define additional keywords in a custom vocabulary rather than + additional format attributes if interoperability is desired.

    +
    +
    +
    +

    +7.3. Defined Formats +

    +
    +

    +7.3.1. Dates, Times, and Duration +

    +

    + These attributes apply to string instances.

    +

    + Date and time format names are derived from + RFC 3339, section 5.6 [RFC3339]. + The duration format is from the ISO 8601 ABNF as given + in Appendix A of RFC 3339.

    +

    + Implementations supporting formats SHOULD implement support for + the following attributes:

    +
    +
    date-time:
    +
    + A string instance is valid against this attribute if it is + a valid representation according to the "date-time' ABNF rule + (referenced above) +
    +
    +
    date:
    +
    + A string instance is valid against this attribute if it is + a valid representation according to the "full-date" ABNF rule + (referenced above) +
    +
    +
    time:
    +
    + A string instance is valid against this attribute if it is + a valid representation according to the "full-time" ABNF rule + (referenced above) +
    +
    +
    duration:
    +
    + A string instance is valid against this attribute if it is + a valid representation according to the "duration" ABNF rule + (referenced above) +
    +
    +
    +

    + Implementations MAY support additional attributes using the other + format names defined anywhere in that RFC. If "full-date" or "full-time" + are implemented, the corresponding short form ("date" or "time" + respectively) MUST be implemented, and MUST behave identically. + Implementations SHOULD NOT define extension attributes + with any name matching an RFC 3339 format unless it validates + according to the rules of that format. + + There is not currently consensus on the need for supporting + all RFC 3339 formats, so this approach of reserving the + namespace will encourage experimentation without committing + to the entire set. Either the format implementation requirements + will become more flexible in general, or these will likely + either be promoted to fully specified attributes or dropped. +

    +
    +
    +

    +7.3.2. Email Addresses +

    +

    + These attributes apply to string instances.

    +

    + A string instance is valid against these attributes if it is a valid + Internet email address as follows:

    +
    +
    email:
    +
    + As defined by the "Mailbox" ABNF rule in + RFC 5321, section 4.1.2 [RFC5321]. +
    +
    +
    idn-email:
    +
    + As defined by the extended "Mailbox" ABNF rule in + RFC 6531, section 3.3 [RFC6531]. +
    +
    +
    +

    + Note that all strings valid against the "email" attribute are also + valid against the "idn-email" attribute.

    +
    +
    +

    +7.3.3. Hostnames +

    +

    + These attributes apply to string instances.

    +

    + A string instance is valid against these attributes if it is a valid + representation for an Internet hostname as follows:

    +
    +
    hostname:
    +
    + As defined by RFC 1123, section 2.1 [RFC1123], + including host names produced using the Punycode algorithm + specified in RFC 5891, section 4.4 [RFC5891]. +
    +
    +
    idn-hostname:
    +
    + As defined by either RFC 1123 as for hostname, or an + internationalized hostname as defined by + RFC 5890, section 2.3.2.3 [RFC5890]. +
    +
    +
    +

    + Note that all strings valid against the "hostname" attribute are also + valid against the "idn-hostname" attribute.

    +
    +
    +

    +7.3.4. IP Addresses +

    +

    + These attributes apply to string instances.

    +

    + A string instance is valid against these attributes if it is a valid + representation of an IP address as follows:

    +
    +
    ipv4:
    +
    + An IPv4 address according to the "dotted-quad" ABNF + syntax as defined in + RFC 2673, section 3.2 [RFC2673]. +
    +
    +
    ipv6:
    +
    + An IPv6 address as defined in + RFC 4291, section 2.2 [RFC4291]. +
    +
    +
    +
    +
    +

    +7.3.5. Resource Identifiers +

    +

    + These attributes apply to string instances.

    +
    +
    uri:
    +
    + A string instance is valid against this attribute if it is + a valid URI, according to [RFC3986]. +
    +
    +
    uri-reference:
    +
    + A string instance is valid against this attribute if it is a valid URI + Reference (either a URI or a relative-reference), + according to [RFC3986]. +
    +
    +
    iri:
    +
    + A string instance is valid against this attribute if it is + a valid IRI, according to [RFC3987]. +
    +
    +
    iri-reference:
    +
    + A string instance is valid against this attribute if it is a valid IRI + Reference (either an IRI or a relative-reference), + according to [RFC3987]. +
    +
    +
    uuid:
    +
    + A string instance is valid against this attribute if it is a valid + string representation of a UUID, according to [RFC4122]. +
    +
    +
    +

    + Note that all valid URIs are valid IRIs, and all valid URI References are + also valid IRI References.

    +

    + Note also that the "uuid" format is for plain UUIDs, not UUIDs in URNs. An example + is "f81d4fae-7dec-11d0-a765-00a0c91e6bf6". For UUIDs as URNs, use the "uri" format, + with a "pattern" regular expression of "^urn:uuid:" to indicate the URI scheme and + URN namespace.

    +
    +
    +

    +7.3.6. uri-template +

    +

    + This attribute applies to string instances.

    +

    + A string instance is valid against this attribute if it is a valid URI Template + (of any level), according to [RFC6570].

    +

    + Note that URI Templates may be used for IRIs; there is no separate + IRI Template specification.

    +
    +
    +

    +7.3.7. JSON Pointers +

    +

    + These attributes apply to string instances.

    +
    +
    json-pointer:
    +
    + A string instance is valid against this attribute if it + is a valid JSON string representation of a JSON Pointer, + according to RFC 6901, section 5 [RFC6901]. +
    +
    +
    relative-json-pointer:
    +
    + A string instance is valid against this attribute if it is a valid + Relative JSON Pointer [relative-json-pointer]. +
    +
    +
    +

    + To allow for both absolute and relative JSON Pointers, use "anyOf" or + "oneOf" to indicate support for either format.

    +
    +
    +

    +7.3.8. regex +

    +

    + This attribute applies to string instances.

    +

    + A regular expression, which SHOULD be valid according to the + ECMA-262 [ecma262] regular expression dialect.

    +

    + Implementations that validate formats MUST accept at least the subset of + ECMA-262 defined in the Regular Expressions (Section 4.3) + section of this specification, and SHOULD accept all valid ECMA-262 expressions.

    +
    +
    +
    +
    +
    +
    +

    +8. A Vocabulary for the Contents of String-Encoded Data +

    +
    +

    +8.1. Foreword +

    +

    + Annotations defined in this section indicate that an instance contains + non-JSON data encoded in a JSON string.

    +

    + These properties provide additional information required to interpret JSON data + as rich multimedia documents. They describe the type of content, how it is encoded, + and/or how it may be validated. They do not function as validation assertions; + a malformed string-encoded document MUST NOT cause the containing instance + to be considered invalid.

    +

    + Meta-schemas that do not use "$vocabulary" SHOULD be considered to + require this vocabulary as if its URI were present with a value of true.

    +

    + The current URI for this vocabulary, known as the Content vocabulary, is: + <https://json-schema.org/draft/2020-12/vocab/content>.

    +

    + The current URI for the corresponding meta-schema is: + https://json-schema.org/draft/2020-12/meta/content.

    +
    +
    +

    +8.2. Implementation Requirements +

    +

    + Due to security and performance concerns, as well as the open-ended nature of + possible content types, implementations MUST NOT automatically decode, parse, + and/or validate the string contents by default. This additionally supports + the use case of embedded documents intended for processing by a different + consumer than that which processed the containing document.

    +

    + All keywords in this section apply only to strings, and have no + effect on other data types.

    +

    + Implementations MAY offer the ability to decode, parse, and/or validate + the string contents automatically. However, it MUST NOT perform these + operations by default, and MUST provide the validation result of each + string-encoded document separately from the enclosing document. This + process SHOULD be equivalent to fully evaluating the instance against + the original schema, followed by using the annotations to decode, parse, + and/or validate each string-encoded document. + + For now, the exact mechanism of performing and returning parsed + data and/or validation results from such an automatic decoding, parsing, + and validating feature is left unspecified. Should such a feature + prove popular, it may be specified more thoroughly in a future draft. +

    +

    + See also the Security Considerations (Section 10) + sections for possible vulnerabilities introduced by automatically + processing the instance string according to these keywords.

    +
    +
    +

    +8.3. contentEncoding +

    +

    + If the instance value is a string, this property defines that the string + SHOULD be interpreted as encoded binary data and decoded using the encoding + named by this property.

    +

    + Possible values indicating base 16, 32, and 64 encodings with several + variations are listed in RFC 4648 [RFC4648]. Additionally, + sections 6.7 and 6.8 of RFC 2045 [RFC2045] provide + encodings used in MIME. This keyword is derived from MIME's + Content-Transfer-Encoding header, which was designed to map binary data + into ASCII characters. It is not related to HTTP's Content-Encoding header, + which is used to encode (e.g. compress or encrypt) + the content of HTTP request and responses.

    +

    + As "base64" is defined in both RFCs, the definition + from RFC 4648 SHOULD be assumed unless the string is specifically intended + for use in a MIME context. Note that all of these encodings result in + strings consisting only of 7-bit ASCII characters. Therefore, this keyword + has no meaning for strings containing characters outside of that range.

    +

    + If this keyword is absent, but "contentMediaType" is present, this + indicates that the encoding is the identity encoding, meaning that + no transformation was needed in order to represent the content in + a UTF-8 string.

    +

    + The value of this property MUST be a string.

    +
    +
    +

    +8.4. contentMediaType +

    +

    + If the instance is a string, this property indicates the media type + of the contents of the string. If "contentEncoding" is present, + this property describes the decoded string.

    +

    + The value of this property MUST be a string, which MUST be a media type, + as defined by RFC 2046 [RFC2046].

    +
    +
    +

    +8.5. contentSchema +

    +

    + If the instance is a string, and if "contentMediaType" is present, this + property contains a schema which describes the structure of the string.

    +

    + This keyword MAY be used with any media type that can be mapped into + JSON Schema's data model.

    +

    + The value of this property MUST be a valid JSON schema. It SHOULD be ignored if + "contentMediaType" is not present.

    +
    +
    +

    +8.6. Example +

    +

    + Here is an example schema, illustrating the use of "contentEncoding" and + "contentMediaType":

    +
    +
    +
    +{
    +    "type": "string",
    +    "contentEncoding": "base64",
    +    "contentMediaType": "image/png"
    +}
    +
    +
    +
    +

    + Instances described by this schema are expected to be strings, + and their values should be interpretable as base64-encoded PNG images.

    +

    + Another example:

    +
    +
    +
    +{
    +    "type": "string",
    +    "contentMediaType": "text/html"
    +}
    +
    +
    +
    +

    + Instances described by this schema are expected to be strings containing HTML, + using whatever character set the JSON string was decoded into. + Per section 8.1 of + RFC 8259 [RFC8259], outside of an entirely closed + system, this MUST be UTF-8.

    +

    + This example describes a JWT that is MACed using the HMAC SHA-256 + algorithm, and requires the "iss" and "exp" fields in its claim set.

    +
    +
    +
    +{
    +    "type": "string",
    +    "contentMediaType": "application/jwt",
    +    "contentSchema": {
    +        "type": "array",
    +        "minItems": 2,
    +        "prefixItems": [
    +            {
    +                "const": {
    +                    "typ": "JWT",
    +                    "alg": "HS256"
    +                }
    +            },
    +            {
    +                "type": "object",
    +                "required": ["iss", "exp"],
    +                "properties": {
    +                    "iss": {"type": "string"},
    +                    "exp": {"type": "integer"}
    +                }
    +            }
    +        ]
    +    }
    +}
    +
    +
    +

    + Note that "contentEncoding" does not appear. While the "application/jwt" + media type makes use of base64url encoding, that is defined by the media + type, which determines how the JWT string is decoded into a list of two + JSON data structures: first the header, and then the payload. Since the + JWT media type ensures that the JWT can be represented in a JSON string, + there is no need for further encoding or decoding.

    +
    +
    +
    +
    +

    +9. A Vocabulary for Basic Meta-Data Annotations +

    +

    + These general-purpose annotation keywords provide commonly used information + for documentation and user interface display purposes. They are not intended + to form a comprehensive set of features. Rather, additional vocabularies + can be defined for more complex annotation-based applications.

    +

    + Meta-schemas that do not use "$vocabulary" SHOULD be considered to + require this vocabulary as if its URI were present with a value of true.

    +

    + The current URI for this vocabulary, known as the Meta-Data vocabulary, is: + <https://json-schema.org/draft/2020-12/vocab/meta-data>.

    +

    + The current URI for the corresponding meta-schema is: + https://json-schema.org/draft/2020-12/meta/meta-data.

    +
    +

    +9.1. "title" and "description" +

    +

    + The value of both of these keywords MUST be a string.

    +

    + Both of these keywords can be used to decorate a user interface with + information about the data produced by this user interface. A title will + preferably be short, whereas a description will provide explanation about + the purpose of the instance described by this schema.

    +
    +
    +

    +9.2. "default" +

    +

    + There are no restrictions placed on the value of this keyword. When + multiple occurrences of this keyword are applicable to a single + sub-instance, implementations SHOULD remove duplicates.

    +

    + This keyword can be used to supply a default JSON value associated with a + particular schema. It is RECOMMENDED that a default value be valid against + the associated schema.

    +
    +
    +

    +9.3. "deprecated" +

    +

    + The value of this keyword MUST be a boolean. When multiple occurrences + of this keyword are applicable to a single sub-instance, applications + SHOULD consider the instance location to be deprecated if any occurrence + specifies a true value.

    +

    + If "deprecated" has a value of boolean true, it indicates that applications + SHOULD refrain from usage of the declared property. It MAY mean the property + is going to be removed in the future.

    +

    + A root schema containing "deprecated" with a value of true indicates that + the entire resource being described MAY be removed in the future.

    +

    + The "deprecated" keyword applies to each instance location to which the + schema object containing the keyword successfully applies. This can + result in scenarios where every array item or object property + is deprecated even though the containing array or object is not.

    +

    + Omitting this keyword has the same behavior as a value of false.

    +
    +
    +

    +9.4. "readOnly" and "writeOnly" +

    +

    + The value of these keywords MUST be a boolean. When multiple occurrences + of these keywords are applicable to a single sub-instance, the resulting + behavior SHOULD be as for a true value if any occurrence specifies a true value, + and SHOULD be as for a false value otherwise.

    +

    + If "readOnly" has a value of boolean true, it indicates that the value + of the instance is managed exclusively by the owning authority, and + attempts by an application to modify the value of this property are + expected to be ignored or rejected by that owning authority.

    +

    + An instance document that is marked as "readOnly" for the entire document + MAY be ignored if sent to the owning authority, or MAY result in an + error, at the authority's discretion.

    +

    + If "writeOnly" has a value of boolean true, it indicates that the value + is never present when the instance is retrieved from the owning authority. + It can be present when sent to the owning authority to update or create + the document (or the resource it represents), but it will not be included + in any updated or newly created version of the instance.

    +

    + An instance document that is marked as "writeOnly" for the entire document + MAY be returned as a blank document of some sort, or MAY produce an error + upon retrieval, or have the retrieval request ignored, at the authority's + discretion.

    +

    + For example, "readOnly" would be used to mark a database-generated serial + number as read-only, while "writeOnly" would be used to mark a password + input field.

    +

    + These keywords can be used to assist in user interface instance generation. + In particular, an application MAY choose to use a widget that hides + input values as they are typed for write-only fields.

    +

    + Omitting these keywords has the same behavior as values of false.

    +
    +
    +

    +9.5. "examples" +

    +

    + The value of this keyword MUST be an array. + There are no restrictions placed on the values within the array. + When multiple occurrences of this keyword are applicable to a single + sub-instance, implementations MUST provide a flat array of all + values rather than an array of arrays.

    +

    + This keyword can be used to provide sample JSON values associated with a + particular schema, for the purpose of illustrating usage. It is + RECOMMENDED that these values be valid against the associated schema.

    +

    + Implementations MAY use the value(s) of "default", if present, as + an additional example. If "examples" is absent, "default" + MAY still be used in this manner.

    +
    +
    +
    +
    +

    +10. Security Considerations +

    +

    + JSON Schema validation defines a vocabulary for JSON Schema core and concerns all + the security considerations listed there.

    +

    + JSON Schema validation allows the use of Regular Expressions, which have numerous + different (often incompatible) implementations. + Some implementations allow the embedding of arbitrary code, which is outside the + scope of JSON Schema and MUST NOT be permitted. + Regular expressions can often also be crafted to be extremely expensive to compute + (with so-called "catastrophic backtracking"), resulting in a denial-of-service + attack.

    +

    + Implementations that support validating or otherwise evaluating instance + string data based on "contentEncoding" and/or "contentMediaType" are at + risk of evaluating data in an unsafe way based on misleading information. + Applications can mitigate this risk by only performing such processing + when a relationship between the schema and instance is established + (e.g., they share the same authority).

    +

    + Processing a media type or encoding is subject to the security considerations + of that media type or encoding. For example, the security considerations + of RFC 4329 Scripting Media Types [RFC4329] apply when + processing JavaScript or ECMAScript encoded within a JSON string.

    +
    +
    +
    +

    +11. References +

    +
    +

    +11.1. Normative References +

    +
    +
    [RFC2119]
    +
    +Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/info/rfc2119>.
    +
    +
    [RFC1123]
    +
    +Braden, R., Ed., "Requirements for Internet Hosts - Application and Support", STD 3, RFC 1123, DOI 10.17487/RFC1123, , <https://www.rfc-editor.org/info/rfc1123>.
    +
    +
    [RFC2045]
    +
    +Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies", RFC 2045, DOI 10.17487/RFC2045, , <https://www.rfc-editor.org/info/rfc2045>.
    +
    +
    [RFC2046]
    +
    +Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types", RFC 2046, DOI 10.17487/RFC2046, , <https://www.rfc-editor.org/info/rfc2046>.
    +
    +
    [RFC2673]
    +
    +Crawford, M., "Binary Labels in the Domain Name System", RFC 2673, DOI 10.17487/RFC2673, , <https://www.rfc-editor.org/info/rfc2673>.
    +
    +
    [RFC3339]
    +
    +Klyne, G. and C. Newman, "Date and Time on the Internet: Timestamps", RFC 3339, DOI 10.17487/RFC3339, , <https://www.rfc-editor.org/info/rfc3339>.
    +
    +
    [RFC3986]
    +
    +Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, DOI 10.17487/RFC3986, , <https://www.rfc-editor.org/info/rfc3986>.
    +
    +
    [RFC3987]
    +
    +Duerst, M. and M. Suignard, "Internationalized Resource Identifiers (IRIs)", RFC 3987, DOI 10.17487/RFC3987, , <https://www.rfc-editor.org/info/rfc3987>.
    +
    +
    [RFC4122]
    +
    +Leach, P., Mealling, M., and R. Salz, "A Universally Unique IDentifier (UUID) URN Namespace", RFC 4122, DOI 10.17487/RFC4122, , <https://www.rfc-editor.org/info/rfc4122>.
    +
    +
    [RFC4291]
    +
    +Hinden, R. and S. Deering, "IP Version 6 Addressing Architecture", RFC 4291, DOI 10.17487/RFC4291, , <https://www.rfc-editor.org/info/rfc4291>.
    +
    +
    [RFC4648]
    +
    +Josefsson, S., "The Base16, Base32, and Base64 Data Encodings", RFC 4648, DOI 10.17487/RFC4648, , <https://www.rfc-editor.org/info/rfc4648>.
    +
    +
    [RFC5321]
    +
    +Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, DOI 10.17487/RFC5321, , <https://www.rfc-editor.org/info/rfc5321>.
    +
    +
    [RFC5890]
    +
    +Klensin, J., "Internationalized Domain Names for Applications (IDNA): Definitions and Document Framework", RFC 5890, DOI 10.17487/RFC5890, , <https://www.rfc-editor.org/info/rfc5890>.
    +
    +
    [RFC5891]
    +
    +Klensin, J., "Internationalized Domain Names in Applications (IDNA): Protocol", RFC 5891, DOI 10.17487/RFC5891, , <https://www.rfc-editor.org/info/rfc5891>.
    +
    +
    [RFC6570]
    +
    +Gregorio, J., Fielding, R., Hadley, M., Nottingham, M., and D. Orchard, "URI Template", RFC 6570, DOI 10.17487/RFC6570, , <https://www.rfc-editor.org/info/rfc6570>.
    +
    +
    [RFC6531]
    +
    +Yao, J. and W. Mao, "SMTP Extension for Internationalized Email", RFC 6531, DOI 10.17487/RFC6531, , <https://www.rfc-editor.org/info/rfc6531>.
    +
    +
    [RFC6901]
    +
    +Bryan, P., Ed., Zyp, K., and M. Nottingham, Ed., "JavaScript Object Notation (JSON) Pointer", RFC 6901, DOI 10.17487/RFC6901, , <https://www.rfc-editor.org/info/rfc6901>.
    +
    +
    [RFC8259]
    +
    +Bray, T., Ed., "The JavaScript Object Notation (JSON) Data Interchange Format", STD 90, RFC 8259, DOI 10.17487/RFC8259, , <https://www.rfc-editor.org/info/rfc8259>.
    +
    +
    [ecma262]
    +
    +"ECMA-262, 11th edition specification", , <https://www.ecma-international.org/ecma-262/11.0>.
    +
    +
    [relative-json-pointer]
    +
    +Luff, G., Andrews, H., and B. Hutton, Ed., "Relative JSON Pointers", Work in Progress, Internet-Draft, draft-handrews-relative-json-pointer-01, , <https://datatracker.ietf.org/doc/html/draft-handrews-relative-json-pointer-01>.
    +
    +
    [json-schema]
    +
    +Wright, A., Andrews, H., Hutton, B., and G. Dennis, "JSON Schema: A Media Type for Describing JSON Documents", Work in Progress, Internet-Draft, draft-bhutton-json-schema-01, , <https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-01>.
    +
    +
    +
    +
    +

    +11.2. Informative References +

    +
    +
    [RFC4329]
    +
    +Hoehrmann, B., "Scripting Media Types", RFC 4329, DOI 10.17487/RFC4329, , <https://www.rfc-editor.org/info/rfc4329>.
    +
    +
    +
    +
    +
    +

    +Appendix A. Keywords Moved from Validation to Core +

    +

    + Several keywords have been moved from this document into the + Core Specification [json-schema] as of this draft, in some + cases with re-naming or other changes. This affects the following former + validation keywords:

    +
    +
    "definitions"
    +
    + Renamed to "$defs" to match "$ref" and be shorter to type. + Schema vocabulary authors SHOULD NOT define a "definitions" keyword + with different behavior in order to avoid invalidating schemas that + still use the older name. While "definitions" is absent in the + single-vocabulary meta-schemas referenced by this document, it + remains present in the default meta-schema, and implementations + SHOULD assume that "$defs" and "definitions" have the same + behavior when that meta-schema is used. +
    +
    +
    "allOf", "anyOf", "oneOf", "not", "if", "then", "else", "items", "additionalItems", "contains", "propertyNames", "properties", "patternProperties", "additionalProperties"
    +
    + All of these keywords apply subschemas to the instance and combine + their results, without asserting any conditions of their own. + Without assertion keywords, these applicators can only cause assertion + failures by using the false boolean schema, or by inverting the result + of the true boolean schema (or equivalent schema objects). + For this reason, they are better defined as a generic mechanism on which + validation, hyper-schema, and extension vocabularies can all be based. +
    +
    +
    "dependencies"
    +
    + This keyword had two different modes of behavior, which made it + relatively challenging to implement and reason about. + The schema form has been moved to Core and renamed to + "dependentSchemas", as part of the applicator vocabulary. + It is analogous to "properties", except that instead of applying + its subschema to the property value, it applies it to the object + containing the property. + The property name array form is retained here and renamed to + "dependentRequired", as it is an assertion which is a shortcut + for the conditional use of the "required" assertion keyword. +
    +
    +
    +
    +
    +

    +Appendix B. Acknowledgments +

    +

    + Thanks to + Gary Court, + Francis Galiegue, + Kris Zyp, + and Geraint Luff + for their work on the initial drafts of JSON Schema.

    +

    + Thanks to + Jason Desrosiers, + Daniel Perrett, + Erik Wilde, + Evgeny Poberezkin, + Brad Bowman, + Gowry Sankar, + Donald Pipowitch, + Dave Finlay, + Denis Laxalde, + Phil Sturgeon, + Shawn Silverman, + and Karen Etheridge + for their submissions and patches to the document.

    +
    +
    +

    +Appendix C. ChangeLog +

    +

    + This section to be removed before leaving Internet-Draft status.

    +
    +
    draft-bhutton-json-schema-validation-01
    +
    +
      +
    • Improve and clarify the "minContains" keyword explanation +
    • +
    • Remove the use of "production" in favour of "ABNF rule" +
    • +
    +
    +
    +
    draft-bhutton-json-schema-validation-00
    +
    +
      +
    • Correct email format RFC reference to 5321 instead of 5322 +
    • +
    • Clarified the set and meaning of "contentEncoding" values +
    • +
    • Reference ECMA-262, 11th edition for regular expression support +
    • +
    • Split "format" into an annotation only vocabulary and an assertion vocabulary +
    • +
    • Clarify "deprecated" when applicable to arrays +
    • +
    +
    +
    +
    draft-handrews-json-schema-validation-02
    +
    +
      +
    • Grouped keywords into formal vocabularies +
    • +
    • Update "format" implementation requirements in terms of vocabularies +
    • +
    • By default, "format" MUST NOT be validated, although validation can be enabled +
    • +
    • A vocabulary declaration can be used to require "format" validation +
    • +
    • Moved "definitions" to the core spec as "$defs" +
    • +
    • Moved applicator keywords to the core spec +
    • +
    • Renamed the array form of "dependencies" to "dependentRequired", moved the schema form to the core spec +
    • +
    • Specified all "content*" keywords as annotations, not assertions +
    • +
    • Added "contentSchema" to allow applying a schema to a string-encoded document +
    • +
    • Also allow RFC 4648 encodings in "contentEncoding" +
    • +
    • Added "minContains" and "maxContains" +
    • +
    • Update RFC reference for "hostname" and "idn-hostname" +
    • +
    • Add "uuid" and "duration" formats +
    • +
    +
    +
    +
    draft-handrews-json-schema-validation-01
    +
    +
      +
    • This draft is purely a clarification with no functional changes +
    • +
    • Provided the general principle behind ignoring annotations under "not" and similar cases +
    • +
    • Clarified "if"/"then"/"else" validation interactions +
    • +
    • Clarified "if"/"then"/"else" behavior for annotation +
    • +
    • Minor formatting and cross-referencing improvements +
    • +
    +
    +
    +
    draft-handrews-json-schema-validation-00
    +
    +
      +
    • Added "if"/"then"/"else" +
    • +
    • Classify keywords as assertions or annotations per the core spec +
    • +
    • Warn of possibly removing "dependencies" in the future +
    • +
    • Grouped validation keywords into sub-sections for readability +
    • +
    • Moved "readOnly" from hyper-schema to validation meta-data +
    • +
    • Added "writeOnly" +
    • +
    • Added string-encoded media section, with former hyper-schema "media" keywords +
    • +
    • Restored "regex" format (removal was unintentional) +
    • +
    • Added "date" and "time" formats, and reserved additional RFC 3339 format names +
    • +
    • I18N formats: "iri", "iri-reference", "idn-hostname", "idn-email" +
    • +
    • Clarify that "json-pointer" format means string encoding, not URI fragment +
    • +
    • Fixed typo that inverted the meaning of "minimum" and "exclusiveMinimum" +
    • +
    • Move format syntax references into Normative References +
    • +
    • JSON is a normative requirement +
    • +
    +
    +
    +
    draft-wright-json-schema-validation-01
    +
    +
      +
    • Standardized on hyphenated format names with full words ("uriref" becomes "uri-reference") +
    • +
    • Add the formats "uri-template" and "json-pointer" +
    • +
    • Changed "exclusiveMaximum"/"exclusiveMinimum" from boolean modifiers of "maximum"/"minimum" to independent numeric fields. +
    • +
    • Split the additionalItems/items into two sections +
    • +
    • Reworked properties/patternProperties/additionalProperties definition +
    • +
    • Added "examples" keyword +
    • +
    • Added "contains" keyword +
    • +
    • Allow empty "required" and "dependencies" arrays +
    • +
    • Fixed "type" reference to primitive types +
    • +
    • Added "const" keyword +
    • +
    • Added "propertyNames" keyword +
    • +
    +
    +
    +
    draft-wright-json-schema-validation-00
    +
    +
      +
    • Added additional security considerations +
    • +
    • Removed reference to "latest version" meta-schema, use numbered version instead +
    • +
    • Rephrased many keyword definitions for brevity +
    • +
    • Added "uriref" format that also allows relative URI references +
    • +
    +
    +
    +
    draft-fge-json-schema-validation-00
    +
    +
      +
    • Initial draft. +
    • +
    • Salvaged from draft v3. +
    • +
    • Redefine the "required" keyword. +
    • +
    • Remove "extends", "disallow" +
    • +
    • Add "anyOf", "allOf", "oneOf", "not", "definitions", "minProperties", + "maxProperties". +
    • +
    • "dependencies" member values can no longer be single strings; at + least one element is required in a property dependency array. +
    • +
    • Rename "divisibleBy" to "multipleOf". +
    • +
    • "type" arrays can no longer have schemas; remove "any" as a possible + value. +
    • +
    • Rework the "format" section; make support optional. +
    • +
    • "format": remove attributes "phone", "style", "color"; rename + "ip-address" to "ipv4"; add references for all attributes. +
    • +
    • Provide algorithms to calculate schema(s) for array/object + instances. +
    • +
    • Add interoperability considerations. +
    • +
    +
    +
    +
    +
    +
    +
    +

    +Authors' Addresses +

    +
    +
    Austin Wright (editor)
    + +
    +
    +
    Henry Andrews (editor)
    + +
    +
    +
    Ben Hutton (editor)
    +
    Postman
    + + +
    +
    +
    + + + From c5d76f2de721d63651b93720ea85cca1009f924f Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Thu, 16 Jun 2022 18:12:35 +0100 Subject: [PATCH 098/206] Mention the updated spec documents on the home page --- index.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.md b/index.md index 57313053..9e0f6d8d 100644 --- a/index.md +++ b/index.md @@ -64,6 +64,10 @@ We monitor the `jsonschema` tag on StackOverflow. ## Project Status +2021-06-10: A patch release of Draft 2020-12 has been published with no functional changes. + +The new IETF document IDs are of the form `draft-bhutton-*-01`. + 2021-02-01: Draft 2020-12 has been published! The IETF document IDs are of the form `draft-bhutton-*-00`. From 73f1d961ae72758a9ae1748e34633fb75e5434d3 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Fri, 17 Jun 2022 09:28:08 +0100 Subject: [PATCH 099/206] Correct date for latest project update --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index 9e0f6d8d..f30d9e8e 100644 --- a/index.md +++ b/index.md @@ -64,7 +64,7 @@ We monitor the `jsonschema` tag on StackOverflow. ## Project Status -2021-06-10: A patch release of Draft 2020-12 has been published with no functional changes. +2022-06-10: A patch release of Draft 2020-12 has been published with no functional changes. The new IETF document IDs are of the form `draft-bhutton-*-01`. From d54787c7ec752afa1b6a86a66bd124181112ba73 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Wed, 22 Jun 2022 12:27:47 +0100 Subject: [PATCH 100/206] Fix indentation for .gitmodules file --- .gitmodules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 5b323ddb..d2f583c4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,18 +10,18 @@ [submodule "_includes/draft-03"] path = _includes/draft-03 url = https://github.com/json-schema-org/json-schema-spec.git - branch = draft-03 + branch = draft-03 [submodule "_includes/draft-04"] path = _includes/draft-04 url = https://github.com/json-schema-org/json-schema-spec.git - branch = draft-04 + branch = draft-04 [submodule "_includes/draft-05"] path = _includes/draft-05 url = https://github.com/json-schema-org/json-schema-spec.git [submodule "_includes/draft-06"] path = _includes/draft-06 url = https://github.com/json-schema-org/json-schema-spec.git - branch = draft-06 + branch = draft-06 [submodule "_includes/draft-07"] path = _includes/draft-07 url = https://github.com/json-schema-org/json-schema-spec.git From 751a1757a16f1c2a5cf12dbc0d6f015d63ff2358 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Jun 2022 12:29:04 +0000 Subject: [PATCH 101/206] Bump addressable from 2.5.2 to 2.8.0 Bumps [addressable](https://github.com/sporkmonger/addressable) from 2.5.2 to 2.8.0. - [Release notes](https://github.com/sporkmonger/addressable/releases) - [Changelog](https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md) - [Commits](https://github.com/sporkmonger/addressable/compare/addressable-2.5.2...addressable-2.8.0) --- updated-dependencies: - dependency-name: addressable dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 57 +++++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 25dd3da2..94b93244 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,8 +6,8 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) coffee-script (2.4.1) coffee-script-source execjs @@ -15,17 +15,19 @@ GEM colorator (1.1.0) commonmarker (0.17.9) ruby-enum (~> 0.5) - concurrent-ruby (1.0.5) - em-websocket (0.5.1) + concurrent-ruby (1.1.10) + em-websocket (0.5.3) eventmachine (>= 0.12.9) - http_parser.rb (~> 0.6.0) - ethon (0.11.0) - ffi (>= 1.3.0) - eventmachine (1.2.5) + http_parser.rb (~> 0) + ethon (0.15.0) + ffi (>= 1.15.0) + eventmachine (1.2.7) execjs (2.7.0) - faraday (0.14.0) - multipart-post (>= 1.2, < 3) - ffi (1.9.23) + faraday (2.3.0) + faraday-net_http (~> 2.0) + ruby2_keywords (>= 0.0.4) + faraday-net_http (2.0.3) + ffi (1.15.5) forwardable-extended (2.6.0) gemoji (3.0.0) github-pages (182) @@ -82,7 +84,7 @@ GEM html-pipeline (2.7.1) activesupport (>= 2) nokogiri (>= 1.4) - http_parser.rb (0.6.0) + http_parser.rb (0.8.0) i18n (0.9.5) concurrent-ruby (~> 1.0) jekyll (3.7.3) @@ -185,7 +187,7 @@ GEM jekyll-seo-tag (~> 2.0) jekyll-titles-from-headings (0.5.1) jekyll (~> 3.3) - jekyll-watch (2.0.0) + jekyll-watch (2.2.1) listen (~> 3.0) jemoji (0.9.0) activesupport (~> 4.0, >= 4.2.9) @@ -205,38 +207,39 @@ GEM jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) minitest (5.11.3) - multipart-post (2.0.0) - net-dns (0.8.0) + net-dns (0.9.0) nokogiri (1.13.6) mini_portile2 (~> 2.8.0) racc (~> 1.4) - octokit (4.8.0) - sawyer (~> 0.8.0, >= 0.5.3) - pathutil (0.16.1) + octokit (4.25.0) + faraday (>= 1, < 3) + sawyer (~> 0.9) + pathutil (0.16.2) forwardable-extended (~> 2.6) public_suffix (2.0.5) racc (1.6.0) - rb-fsevent (0.10.3) - rb-inotify (0.9.10) - ffi (>= 0.5.0, < 2) + rb-fsevent (0.11.1) + rb-inotify (0.10.1) + ffi (~> 1.0) rouge (2.2.1) ruby-enum (0.7.2) i18n + ruby2_keywords (0.0.5) ruby_dep (1.5.0) rubyzip (2.0.0) - safe_yaml (1.0.4) - sass (3.5.6) + safe_yaml (1.0.5) + sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sawyer (0.8.1) - addressable (>= 2.3.5, < 2.6) - faraday (~> 0.8, < 1.0) + sawyer (0.9.2) + addressable (>= 2.3.5) + faraday (>= 0.17.3, < 3) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) thread_safe (0.3.6) - typhoeus (1.3.0) + typhoeus (1.4.0) ethon (>= 0.9.0) tzinfo (1.2.5) thread_safe (~> 0.1) From fe609af26e5eb6af03ef2d1c915c5beb44ebb9d8 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Wed, 22 Jun 2022 10:25:40 -0400 Subject: [PATCH 102/206] Update github-pages (and transitive deps of it). Should solve the remaining dependabot alert about kramdown, which otherwise is refusing to send a PR (because the version of github-pages was too old). --- Gemfile.lock | 274 ++++++++++++++++++++++++++------------------------- 1 file changed, 141 insertions(+), 133 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 94b93244..1f5915d2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,11 +1,12 @@ GEM remote: https://rubygems.org/ specs: - activesupport (4.2.9) - i18n (~> 0.7) + activesupport (6.0.5) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) + zeitwerk (~> 2.2, >= 2.2.2) addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) coffee-script (2.4.1) @@ -13,201 +14,204 @@ GEM execjs coffee-script-source (1.11.1) colorator (1.1.0) - commonmarker (0.17.9) - ruby-enum (~> 0.5) + commonmarker (0.23.5) concurrent-ruby (1.1.10) + dnsruby (1.61.9) + simpleidn (~> 0.1) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) ethon (0.15.0) ffi (>= 1.15.0) eventmachine (1.2.7) - execjs (2.7.0) + execjs (2.8.1) faraday (2.3.0) faraday-net_http (~> 2.0) ruby2_keywords (>= 0.0.4) faraday-net_http (2.0.3) ffi (1.15.5) forwardable-extended (2.6.0) - gemoji (3.0.0) - github-pages (182) - activesupport (= 4.2.9) - github-pages-health-check (= 1.4.0) - jekyll (= 3.7.3) - jekyll-avatar (= 0.5.0) + gemoji (3.0.1) + github-pages (226) + github-pages-health-check (= 1.17.9) + jekyll (= 3.9.2) + jekyll-avatar (= 0.7.0) jekyll-coffeescript (= 1.1.1) - jekyll-commonmark-ghpages (= 0.1.5) + jekyll-commonmark-ghpages (= 0.2.0) jekyll-default-layout (= 0.1.4) - jekyll-feed (= 0.9.3) + jekyll-feed (= 0.15.1) jekyll-gist (= 1.5.0) - jekyll-github-metadata (= 2.9.4) - jekyll-mentions (= 1.3.0) - jekyll-optional-front-matter (= 0.3.0) + jekyll-github-metadata (= 2.13.0) + jekyll-include-cache (= 0.2.1) + jekyll-mentions (= 1.6.0) + jekyll-optional-front-matter (= 0.3.2) jekyll-paginate (= 1.1.0) - jekyll-readme-index (= 0.2.0) - jekyll-redirect-from (= 0.13.0) - jekyll-relative-links (= 0.5.3) - jekyll-remote-theme (= 0.2.3) + jekyll-readme-index (= 0.3.0) + jekyll-redirect-from (= 0.16.0) + jekyll-relative-links (= 0.6.1) + jekyll-remote-theme (= 0.4.3) jekyll-sass-converter (= 1.5.2) - jekyll-seo-tag (= 2.4.0) - jekyll-sitemap (= 1.2.0) - jekyll-swiss (= 0.4.0) - jekyll-theme-architect (= 0.1.1) - jekyll-theme-cayman (= 0.1.1) - jekyll-theme-dinky (= 0.1.1) - jekyll-theme-hacker (= 0.1.1) - jekyll-theme-leap-day (= 0.1.1) - jekyll-theme-merlot (= 0.1.1) - jekyll-theme-midnight (= 0.1.1) - jekyll-theme-minimal (= 0.1.1) - jekyll-theme-modernist (= 0.1.1) - jekyll-theme-primer (= 0.5.3) - jekyll-theme-slate (= 0.1.1) - jekyll-theme-tactile (= 0.1.1) - jekyll-theme-time-machine (= 0.1.1) - jekyll-titles-from-headings (= 0.5.1) - jemoji (= 0.9.0) - kramdown (= 1.16.2) - liquid (= 4.0.0) - listen (= 3.1.5) + jekyll-seo-tag (= 2.8.0) + jekyll-sitemap (= 1.4.0) + jekyll-swiss (= 1.0.0) + jekyll-theme-architect (= 0.2.0) + jekyll-theme-cayman (= 0.2.0) + jekyll-theme-dinky (= 0.2.0) + jekyll-theme-hacker (= 0.2.0) + jekyll-theme-leap-day (= 0.2.0) + jekyll-theme-merlot (= 0.2.0) + jekyll-theme-midnight (= 0.2.0) + jekyll-theme-minimal (= 0.2.0) + jekyll-theme-modernist (= 0.2.0) + jekyll-theme-primer (= 0.6.0) + jekyll-theme-slate (= 0.2.0) + jekyll-theme-tactile (= 0.2.0) + jekyll-theme-time-machine (= 0.2.0) + jekyll-titles-from-headings (= 0.5.3) + jemoji (= 0.12.0) + kramdown (= 2.3.2) + kramdown-parser-gfm (= 1.1.0) + liquid (= 4.0.3) mercenary (~> 0.3) - minima (= 2.4.1) - nokogiri (>= 1.8.1, < 2.0) - rouge (= 2.2.1) + minima (= 2.5.1) + nokogiri (>= 1.13.4, < 2.0) + rouge (= 3.26.0) terminal-table (~> 1.4) - github-pages-health-check (1.4.0) + github-pages-health-check (1.17.9) addressable (~> 2.3) - net-dns (~> 0.8) + dnsruby (~> 1.60) octokit (~> 4.0) - public_suffix (~> 2.0) + public_suffix (>= 3.0, < 5.0) typhoeus (~> 1.3) - html-pipeline (2.7.1) + html-pipeline (2.14.2) activesupport (>= 2) nokogiri (>= 1.4) http_parser.rb (0.8.0) i18n (0.9.5) concurrent-ruby (~> 1.0) - jekyll (3.7.3) + jekyll (3.9.2) addressable (~> 2.4) colorator (~> 1.0) em-websocket (~> 0.5) i18n (~> 0.7) jekyll-sass-converter (~> 1.0) jekyll-watch (~> 2.0) - kramdown (~> 1.14) + kramdown (>= 1.17, < 3) liquid (~> 4.0) mercenary (~> 0.3.3) pathutil (~> 0.9) rouge (>= 1.7, < 4) safe_yaml (~> 1.0) - jekyll-avatar (0.5.0) - jekyll (~> 3.0) + jekyll-avatar (0.7.0) + jekyll (>= 3.0, < 5.0) jekyll-coffeescript (1.1.1) coffee-script (~> 2.2) coffee-script-source (~> 1.11.1) - jekyll-commonmark (1.2.0) - commonmarker (~> 0.14) - jekyll (>= 3.0, < 4.0) - jekyll-commonmark-ghpages (0.1.5) - commonmarker (~> 0.17.6) - jekyll-commonmark (~> 1) - rouge (~> 2) + jekyll-commonmark (1.4.0) + commonmarker (~> 0.22) + jekyll-commonmark-ghpages (0.2.0) + commonmarker (~> 0.23.4) + jekyll (~> 3.9.0) + jekyll-commonmark (~> 1.4.0) + rouge (>= 2.0, < 4.0) jekyll-default-layout (0.1.4) jekyll (~> 3.0) - jekyll-feed (0.9.3) - jekyll (~> 3.3) + jekyll-feed (0.15.1) + jekyll (>= 3.7, < 5.0) jekyll-gist (1.5.0) octokit (~> 4.2) - jekyll-github-metadata (2.9.4) - jekyll (~> 3.1) + jekyll-github-metadata (2.13.0) + jekyll (>= 3.4, < 5.0) octokit (~> 4.0, != 4.4.0) - jekyll-mentions (1.3.0) - activesupport (~> 4.0) + jekyll-include-cache (0.2.1) + jekyll (>= 3.7, < 5.0) + jekyll-mentions (1.6.0) html-pipeline (~> 2.3) - jekyll (~> 3.0) - jekyll-optional-front-matter (0.3.0) - jekyll (~> 3.0) + jekyll (>= 3.7, < 5.0) + jekyll-optional-front-matter (0.3.2) + jekyll (>= 3.0, < 5.0) jekyll-paginate (1.1.0) - jekyll-readme-index (0.2.0) - jekyll (~> 3.0) - jekyll-redirect-from (0.13.0) - jekyll (~> 3.3) - jekyll-relative-links (0.5.3) - jekyll (~> 3.3) - jekyll-remote-theme (0.2.3) - jekyll (~> 3.5) - rubyzip (>= 1.2.1, < 3.0) - typhoeus (>= 0.7, < 2.0) + jekyll-readme-index (0.3.0) + jekyll (>= 3.0, < 5.0) + jekyll-redirect-from (0.16.0) + jekyll (>= 3.3, < 5.0) + jekyll-relative-links (0.6.1) + jekyll (>= 3.3, < 5.0) + jekyll-remote-theme (0.4.3) + addressable (~> 2.0) + jekyll (>= 3.5, < 5.0) + jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0) + rubyzip (>= 1.3.0, < 3.0) jekyll-sass-converter (1.5.2) sass (~> 3.4) - jekyll-seo-tag (2.4.0) - jekyll (~> 3.3) - jekyll-sitemap (1.2.0) - jekyll (~> 3.3) - jekyll-swiss (0.4.0) - jekyll-theme-architect (0.1.1) - jekyll (~> 3.5) + jekyll-seo-tag (2.8.0) + jekyll (>= 3.8, < 5.0) + jekyll-sitemap (1.4.0) + jekyll (>= 3.7, < 5.0) + jekyll-swiss (1.0.0) + jekyll-theme-architect (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-cayman (0.1.1) - jekyll (~> 3.5) + jekyll-theme-cayman (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-dinky (0.1.1) - jekyll (~> 3.5) + jekyll-theme-dinky (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-hacker (0.1.1) - jekyll (~> 3.5) + jekyll-theme-hacker (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-leap-day (0.1.1) - jekyll (~> 3.5) + jekyll-theme-leap-day (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-merlot (0.1.1) - jekyll (~> 3.5) + jekyll-theme-merlot (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-midnight (0.1.1) - jekyll (~> 3.5) + jekyll-theme-midnight (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-minimal (0.1.1) - jekyll (~> 3.5) + jekyll-theme-minimal (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-modernist (0.1.1) - jekyll (~> 3.5) + jekyll-theme-modernist (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-primer (0.5.3) - jekyll (~> 3.5) + jekyll-theme-primer (0.6.0) + jekyll (> 3.5, < 5.0) jekyll-github-metadata (~> 2.9) jekyll-seo-tag (~> 2.0) - jekyll-theme-slate (0.1.1) - jekyll (~> 3.5) + jekyll-theme-slate (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-tactile (0.1.1) - jekyll (~> 3.5) + jekyll-theme-tactile (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-time-machine (0.1.1) - jekyll (~> 3.5) + jekyll-theme-time-machine (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-titles-from-headings (0.5.1) - jekyll (~> 3.3) + jekyll-titles-from-headings (0.5.3) + jekyll (>= 3.3, < 5.0) jekyll-watch (2.2.1) listen (~> 3.0) - jemoji (0.9.0) - activesupport (~> 4.0, >= 4.2.9) + jemoji (0.12.0) gemoji (~> 3.0) html-pipeline (~> 2.2) - jekyll (~> 3.0) - kramdown (1.16.2) - liquid (4.0.0) - listen (3.1.5) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - ruby_dep (~> 1.2) + jekyll (>= 3.0, < 5.0) + kramdown (2.3.2) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + liquid (4.0.3) + listen (3.7.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.3.6) mini_portile2 (2.8.0) - minima (2.4.1) - jekyll (~> 3.5) + minima (2.5.1) + jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) - minitest (5.11.3) - net-dns (0.9.0) + minitest (5.16.1) nokogiri (1.13.6) mini_portile2 (~> 2.8.0) racc (~> 1.4) @@ -216,17 +220,15 @@ GEM sawyer (~> 0.9) pathutil (0.16.2) forwardable-extended (~> 2.6) - public_suffix (2.0.5) + public_suffix (4.0.7) racc (1.6.0) rb-fsevent (0.11.1) rb-inotify (0.10.1) ffi (~> 1.0) - rouge (2.2.1) - ruby-enum (0.7.2) - i18n + rexml (3.2.5) + rouge (3.26.0) ruby2_keywords (0.0.5) - ruby_dep (1.5.0) - rubyzip (2.0.0) + rubyzip (2.3.2) safe_yaml (1.0.5) sass (3.7.4) sass-listen (~> 4.0.0) @@ -236,14 +238,20 @@ GEM sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) + simpleidn (0.2.1) + unf (~> 0.1.4) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) thread_safe (0.3.6) typhoeus (1.4.0) ethon (>= 0.9.0) - tzinfo (1.2.5) + tzinfo (1.2.9) thread_safe (~> 0.1) - unicode-display_width (1.3.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.8.2) + unicode-display_width (1.8.0) + zeitwerk (2.6.0) PLATFORMS ruby From bd21c05b50996bfb9003f833f371ff270d1e689e Mon Sep 17 00:00:00 2001 From: Clemens Uhlenhut Date: Wed, 29 Jun 2022 09:55:12 +0200 Subject: [PATCH 103/206] Added JSONBuddy Cli tool --- _data/validator-libraries-modern.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index ca0a2517..e947896d 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -362,3 +362,9 @@ date-draft: draft: [7, 6, 4] notes: wraps [xeipuuv/gojsonschema](https://github.com/xeipuuv/gojsonschema) + - name: valbuddy + license: Free and commercial versions + url: 'https://www.json-buddy.com/json-validator-command-line-tool.htm' + date-draft: + draft: [2019-09, 7, 6, 4] + notes: JSONBuddy cli tool. Windows platform. Support for large data and streaming validation. \ No newline at end of file From 51d141618b708e169ea750303e71341164b381c5 Mon Sep 17 00:00:00 2001 From: Clemens Uhlenhut Date: Wed, 29 Jun 2022 12:37:11 +0200 Subject: [PATCH 104/206] Update _data/validator-libraries-modern.yml Co-authored-by: Ben Hutton --- _data/validator-libraries-modern.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index e947896d..86ef7bb8 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -363,7 +363,7 @@ draft: [7, 6, 4] notes: wraps [xeipuuv/gojsonschema](https://github.com/xeipuuv/gojsonschema) - name: valbuddy - license: Free and commercial versions + license: Free and commercial versions (proprietary) url: 'https://www.json-buddy.com/json-validator-command-line-tool.htm' date-draft: draft: [2019-09, 7, 6, 4] From 2714cae4526b4b5b68b964b2114790a6dc02adc9 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Mon, 11 Jul 2022 09:38:22 +0100 Subject: [PATCH 105/206] Update day and time for Open Community Working Meetings --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index f30d9e8e..df042724 100644 --- a/index.md +++ b/index.md @@ -41,7 +41,7 @@ We hold weekly Office Hours and twice monthly Open Community Working Meetings. Office Hours are every first Tuesday of the month at 15:00 UTC, and by appointment. -Open Community Working Meetings are every First and Third Friday of the month at 12:00 PT. +Open Community Working Meetings are every First and Third Monday of the month at 14:00 PT. ## Need more? From 08d994de463b8a7b59b73d73a772b37d425ce258 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 22 Jul 2022 09:36:08 +0000 Subject: [PATCH 106/206] Bump tzinfo from 1.2.9 to 1.2.10 Bumps [tzinfo](https://github.com/tzinfo/tzinfo) from 1.2.9 to 1.2.10. - [Release notes](https://github.com/tzinfo/tzinfo/releases) - [Changelog](https://github.com/tzinfo/tzinfo/blob/master/CHANGES.md) - [Commits](https://github.com/tzinfo/tzinfo/compare/v1.2.9...v1.2.10) --- updated-dependencies: - dependency-name: tzinfo dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1f5915d2..a406fa2a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -245,7 +245,7 @@ GEM thread_safe (0.3.6) typhoeus (1.4.0) ethon (>= 0.9.0) - tzinfo (1.2.9) + tzinfo (1.2.10) thread_safe (~> 0.1) unf (0.1.4) unf_ext From bbc6caaa81181d3ad881c146e8c822e5ce246a3e Mon Sep 17 00:00:00 2001 From: datensen <46059055+datensen@users.noreply.github.com> Date: Fri, 29 Jul 2022 15:11:47 +0200 Subject: [PATCH 107/206] add Perseid Modeler --- implementations.md | 1 + 1 file changed, 1 insertion(+) diff --git a/implementations.md b/implementations.md index 9ff96380..92197240 100644 --- a/implementations.md +++ b/implementations.md @@ -268,6 +268,7 @@ _None currently support draft-06 or later._ - [JSONEditor Online](https://jsoneditoronline.org/) - *View, edit, format, and validate JSON online* Support draft-4, draft-6, and draft-7. - [Liquid JSON Schema Editor](https://www.liquid-technologies.com/json-schema-editor) - *Graphical JSON Schema editor for draft-04, draft-06, draft-07 and 2019-09, with split source code and grphical editing. Includes validation of JSON files based on JSON Schema, JSON Sample Generator and JSON Schema Documentation Generator.* - [Oxygen JSON Editor](https://www.oxygenxml.com/xml_editor/json.html) - *JSON editor with a variety of editing features and helper views. Support for validation and editing JSON Schema draft-4, draft-6, and draft-7. Validation and editing of JSON files based on JSON Schema.* +- [Perseid Modeler](https://www.datensen.com/data-modeling/perseid-modeler-for-json-schema.html) - *a modeling tool for JSON Schema and OpenAPI. Key features include: visual JSON schema creation using tree and ERD-like diagrams, support for JSON schema structures including operators and conditions, import of existing schemas from files, creation of detailed HTML reports, export to PDF, script generation, and more.* - [Stoplight Studio](https://stoplight.io/) - *JSON Schema IDE (text-based and GUI) with support for JSON/YAML linting, which can also be based on JSON Schema rules via Spectral. Support for draft-4, draft-6 and draft-7.* - [Visual Studio Code](https://code.visualstudio.com/) - *Schema driven code completion, hovers and validation for editing JSON files (including schemas)* - [WebStorm](https://www.jetbrains.com/webstorm/), [IntelliJ IDEA](https://www.jetbrains.com/idea/), and other [JetBrains IDEs](https://www.jetbrains.com/products.html?fromMenu#type=ide) - *Code completion, documentation, and validation for JSON and YAML files using JSON Schema. Support for draft-4, draft-6, and draft-7.* From c2d3acd658953087f0b0a859185aef87a0519c7a Mon Sep 17 00:00:00 2001 From: datensen <46059055+datensen@users.noreply.github.com> Date: Fri, 29 Jul 2022 17:48:55 +0200 Subject: [PATCH 108/206] updated version supported by Perseid Modeler --- implementations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implementations.md b/implementations.md index 92197240..d82ce3f9 100644 --- a/implementations.md +++ b/implementations.md @@ -268,7 +268,7 @@ _None currently support draft-06 or later._ - [JSONEditor Online](https://jsoneditoronline.org/) - *View, edit, format, and validate JSON online* Support draft-4, draft-6, and draft-7. - [Liquid JSON Schema Editor](https://www.liquid-technologies.com/json-schema-editor) - *Graphical JSON Schema editor for draft-04, draft-06, draft-07 and 2019-09, with split source code and grphical editing. Includes validation of JSON files based on JSON Schema, JSON Sample Generator and JSON Schema Documentation Generator.* - [Oxygen JSON Editor](https://www.oxygenxml.com/xml_editor/json.html) - *JSON editor with a variety of editing features and helper views. Support for validation and editing JSON Schema draft-4, draft-6, and draft-7. Validation and editing of JSON files based on JSON Schema.* -- [Perseid Modeler](https://www.datensen.com/data-modeling/perseid-modeler-for-json-schema.html) - *a modeling tool for JSON Schema and OpenAPI. Key features include: visual JSON schema creation using tree and ERD-like diagrams, support for JSON schema structures including operators and conditions, import of existing schemas from files, creation of detailed HTML reports, export to PDF, script generation, and more.* +- [Perseid Modeler](https://www.datensen.com/data-modeling/perseid-modeler-for-json-schema.html) - *a modeling tool for JSON Schema and OpenAPI. Key features include: visual JSON schema creation using tree and ERD-like diagrams, support for JSON schema structures including operators and conditions, import of existing schemas from files, creation of detailed HTML reports, export to PDF, script generation, and more. Supported versions: draft 4, 6,7, 2019-09 and 2020-12* - [Stoplight Studio](https://stoplight.io/) - *JSON Schema IDE (text-based and GUI) with support for JSON/YAML linting, which can also be based on JSON Schema rules via Spectral. Support for draft-4, draft-6 and draft-7.* - [Visual Studio Code](https://code.visualstudio.com/) - *Schema driven code completion, hovers and validation for editing JSON files (including schemas)* - [WebStorm](https://www.jetbrains.com/webstorm/), [IntelliJ IDEA](https://www.jetbrains.com/idea/), and other [JetBrains IDEs](https://www.jetbrains.com/products.html?fromMenu#type=ide) - *Code completion, documentation, and validation for JSON and YAML files using JSON Schema. Support for draft-4, draft-6, and draft-7.* From e342d397f5f6df9d5bc06542c929bb32ea9bf840 Mon Sep 17 00:00:00 2001 From: datensen <46059055+datensen@users.noreply.github.com> Date: Fri, 29 Jul 2022 17:50:03 +0200 Subject: [PATCH 109/206] Minor update for Perseid Modeler --- implementations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implementations.md b/implementations.md index d82ce3f9..8cffdd0d 100644 --- a/implementations.md +++ b/implementations.md @@ -268,7 +268,7 @@ _None currently support draft-06 or later._ - [JSONEditor Online](https://jsoneditoronline.org/) - *View, edit, format, and validate JSON online* Support draft-4, draft-6, and draft-7. - [Liquid JSON Schema Editor](https://www.liquid-technologies.com/json-schema-editor) - *Graphical JSON Schema editor for draft-04, draft-06, draft-07 and 2019-09, with split source code and grphical editing. Includes validation of JSON files based on JSON Schema, JSON Sample Generator and JSON Schema Documentation Generator.* - [Oxygen JSON Editor](https://www.oxygenxml.com/xml_editor/json.html) - *JSON editor with a variety of editing features and helper views. Support for validation and editing JSON Schema draft-4, draft-6, and draft-7. Validation and editing of JSON files based on JSON Schema.* -- [Perseid Modeler](https://www.datensen.com/data-modeling/perseid-modeler-for-json-schema.html) - *a modeling tool for JSON Schema and OpenAPI. Key features include: visual JSON schema creation using tree and ERD-like diagrams, support for JSON schema structures including operators and conditions, import of existing schemas from files, creation of detailed HTML reports, export to PDF, script generation, and more. Supported versions: draft 4, 6,7, 2019-09 and 2020-12* +- [Perseid Modeler](https://www.datensen.com/data-modeling/perseid-modeler-for-json-schema.html) - *a modeling tool for JSON Schema and OpenAPI. Key features include: visual JSON schema creation using tree and ERD-like diagrams, support for JSON schema structures including operators and conditions, import of existing schemas from files, creation of detailed HTML reports, export to PDF, script generation, and more. Supported versions: draft 4, 6, 7, 2019-09 and 2020-12* - [Stoplight Studio](https://stoplight.io/) - *JSON Schema IDE (text-based and GUI) with support for JSON/YAML linting, which can also be based on JSON Schema rules via Spectral. Support for draft-4, draft-6 and draft-7.* - [Visual Studio Code](https://code.visualstudio.com/) - *Schema driven code completion, hovers and validation for editing JSON files (including schemas)* - [WebStorm](https://www.jetbrains.com/webstorm/), [IntelliJ IDEA](https://www.jetbrains.com/idea/), and other [JetBrains IDEs](https://www.jetbrains.com/products.html?fromMenu#type=ide) - *Code completion, documentation, and validation for JSON and YAML files using JSON Schema. Support for draft-4, draft-6, and draft-7.* From 90416a4885cb1d9654f852e177770a1a0fbb7eb6 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Thu, 4 Aug 2022 19:04:20 -0400 Subject: [PATCH 110/206] Add Alterschema to the implementations list Signed-off-by: Juan Cruz Viotti --- implementations.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/implementations.md b/implementations.md index 9ff96380..a6799cbc 100644 --- a/implementations.md +++ b/implementations.md @@ -240,7 +240,8 @@ the utility, and decided on a case-by-case basis. #### Schema draft migration -_None currently support draft-06 or later._ +- JavaScript + - [AlterSchema](https://github.com/sourcemeta/alterschema) _JSON Schema 2020-12, 2019-09, draft-07, -06, -04_ #### Format converters From d19bf5270fa04451fdffca3a51d4858bef847982 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Tue, 9 Aug 2022 10:40:34 +0300 Subject: [PATCH 111/206] Add a Glossary page with 2 initial entries. Doing so should hopefully now allow farming out additional entries. Refs: json-schema-org/community#199. --- learn/glossary.md | 33 +++++++++++++++++++++++++++++++++ learn/index.md | 1 + 2 files changed, 34 insertions(+) create mode 100644 learn/glossary.md diff --git a/learn/glossary.md b/learn/glossary.md new file mode 100644 index 00000000..858b9e41 --- /dev/null +++ b/learn/glossary.md @@ -0,0 +1,33 @@ +# JSON Schema Glossary + +This document collects short explanations of terminology one may encounter within the JSON Schema community. + +Whilst many of the entries below have precise technical definitions, preference is given to explanations of their conversational use, with additional references linked for further information. +This page is not meant to be [normative](#normative), nor is it meant to contain fully original research or explanation. +It is meant to aid the understanding of those less familiar with formal language used within JSON Schema, or within specifications more broadly. +(In fact, entries below make effort to avoid terminology like "normative" itself for reasons just mentioned.) + +The entries on this page can be linked to via anchor links (e.g. `https://json-schema.org/learn/glossary.html#vocabulary`) when sharing a definition with others. + +### draft + +An individual release of the JSON Schema specification. + +JSON Schema drafts are not intended to be provisional documents, as the layman's use of the word "draft" might indicate. + +While future drafts may introduce new behavior or changes to existing behavior, each draft is a completed, released document, batching together changes to the specification, and intended for implementation and use. + +The current list of drafts can be found [here](https://json-schema.org/specification-links.html#published-drafts). + +### normative + +In the context of JSON Schema, and formal specifications more broadly, a document which outlines standardized behavior. +This is as distinct from *non*-normative or informational documents, meant to explain, simplify or offer opinions. + +Distinguishing between whether a document is normative or not is intended to clarify to those using the document whether its contents are allowed to contradict or augment behavior described in other normative documents. +JSON Schema's normative documents notably include its [specification](https://json-schema.org/specification.html). +This page for instance, not being a normative document, is not able to proscribe new JSON Schema behavior not already covered by the specification. + +##### See also + +* [normative](https://developer.mozilla.org/en-US/docs/Glossary/Normative) and [non-normative](https://developer.mozilla.org/en-US/docs/Glossary/non-normative) in the Mozilla Glossary, and its links diff --git a/learn/index.md b/learn/index.md index 32716050..37c3a883 100644 --- a/learn/index.md +++ b/learn/index.md @@ -12,3 +12,4 @@ title: Learn * [card.schema.json](./examples/card.schema.json) * [geographical-location.schema.json](./examples/geographical-location.schema.json) * [Understanding JSON Schema](/understanding-json-schema/) +* [JSON Schema Glossary](./glossary.md) which attempts to explain conversational terminology From fee524d04abc93e3f615053aafa38cfc1d6ef2b1 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Tue, 9 Aug 2022 21:44:53 +0300 Subject: [PATCH 112/206] Add the proper header for the glossary markdown file. --- learn/glossary.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/learn/glossary.md b/learn/glossary.md index 858b9e41..52284449 100644 --- a/learn/glossary.md +++ b/learn/glossary.md @@ -1,4 +1,7 @@ -# JSON Schema Glossary +--- +layout: page +title: JSON Schema Glossary +--- This document collects short explanations of terminology one may encounter within the JSON Schema community. From 4e0d93ba2a38f6c53f2cd31f96acfe79819555b8 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Wed, 10 Aug 2022 16:43:32 +0300 Subject: [PATCH 113/206] Add a solicitation for further glossary entries. --- learn/glossary.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/learn/glossary.md b/learn/glossary.md index 52284449..ce4ed2fb 100644 --- a/learn/glossary.md +++ b/learn/glossary.md @@ -10,6 +10,8 @@ This page is not meant to be [normative](#normative), nor is it meant to contain It is meant to aid the understanding of those less familiar with formal language used within JSON Schema, or within specifications more broadly. (In fact, entries below make effort to avoid terminology like "normative" itself for reasons just mentioned.) +If you encounter a term you wish were defined here, please feel free to [file an issue requesting it](https://github.com/json-schema-org/json-schema-org.github.io/issues/new?title=Add%20a%20glossary%20entry%20for%20). + The entries on this page can be linked to via anchor links (e.g. `https://json-schema.org/learn/glossary.html#vocabulary`) when sharing a definition with others. ### draft From 77d5a40f69923b269a7ddd28efda1c235ab92036 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Wed, 10 Aug 2022 16:46:33 +0300 Subject: [PATCH 114/206] Try including anchor headings via allejo/jekyll-anchor-headings. --- _includes/anchor_headings.html | 172 +++++++++++++++++++++++++++++++++ _layouts/default.html | 2 +- 2 files changed, 173 insertions(+), 1 deletion(-) create mode 100644 _includes/anchor_headings.html diff --git a/_includes/anchor_headings.html b/_includes/anchor_headings.html new file mode 100644 index 00000000..f8e22d6a --- /dev/null +++ b/_includes/anchor_headings.html @@ -0,0 +1,172 @@ +{% capture headingsWorkspace %} + {% comment %} + Copyright (c) 2018 Vladimir "allejo" Jimenez + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + {% endcomment %} + {% comment %} + Version 1.0.11 + https://github.com/allejo/jekyll-anchor-headings + + "Be the pull request you wish to see in the world." ~Ben Balter + + Usage: + {% include anchor_headings.html html=content anchorBody="#" %} + + Parameters: + * html (string) - the HTML of compiled markdown generated by kramdown in Jekyll + + Optional Parameters: + * beforeHeading (bool) : false - Set to true if the anchor should be placed _before_ the heading's content + * headerAttrs (string) : '' - Any custom HTML attributes that will be added to the heading tag; you may NOT use `id`; + the `%heading%` and `%html_id%` placeholders are available + * anchorAttrs (string) : '' - Any custom HTML attributes that will be added to the `` tag; you may NOT use `href`, `class` or `title`; + the `%heading%` and `%html_id%` placeholders are available + * anchorBody (string) : '' - The content that will be placed inside the anchor; the `%heading%` placeholder is available + * anchorClass (string) : '' - The class(es) that will be used for each anchor. Separate multiple classes with a space + * anchorTitle (string) : '' - The `title` attribute that will be used for anchors + * h_min (int) : 1 - The minimum header level to build an anchor for; any header lower than this value will be ignored + * h_max (int) : 6 - The maximum header level to build an anchor for; any header greater than this value will be ignored + * bodyPrefix (string) : '' - Anything that should be inserted inside of the heading tag _before_ its anchor and content + * bodySuffix (string) : '' - Anything that should be inserted inside of the heading tag _after_ its anchor and content + * generateId (true) : false - Set to true if a header without id should generate an id to use. + + Output: + The original HTML with the addition of anchors inside of all of the h1-h6 headings. + {% endcomment %} + + {% assign minHeader = include.h_min | default: 1 %} + {% assign maxHeader = include.h_max | default: 6 %} + {% assign beforeHeading = include.beforeHeading %} + {% assign headerAttrs = include.headerAttrs %} + {% assign nodes = include.html | split: ' + {% if headerLevel == 0 %} + + {% assign firstChunk = node | split: '>' | first %} + + + {% unless firstChunk contains '<' %} + {% capture node %}{% endcapture %} + {% assign _workspace = node | split: _closingTag %} + {% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %} + {% assign header = _workspace[0] | replace: _hAttrToStrip, '' %} + {% assign escaped_header = header | strip_html | strip %} + + {% assign _classWorkspace = _workspace[0] | split: 'class="' %} + {% assign _classWorkspace = _classWorkspace[1] | split: '"' %} + {% assign _html_class = _classWorkspace[0] %} + + {% if _html_class contains "no_anchor" %} + {% assign skip_anchor = true %} + {% else %} + {% assign skip_anchor = false %} + {% endif %} + + {% assign _idWorkspace = _workspace[0] | split: 'id="' %} + {% if _idWorkspace[1] %} + {% assign _idWorkspace = _idWorkspace[1] | split: '"' %} + {% assign html_id = _idWorkspace[0] %} + {% elsif include.generateId %} + + {% assign html_id = escaped_header | slugify %} + {% if html_id == "" %} + {% assign html_id = false %} + {% endif %} + {% capture headerAttrs %}{{ headerAttrs }} id="%html_id%"{% endcapture %} + {% endif %} + + + {% capture anchor %}{% endcapture %} + + {% if skip_anchor == false and html_id and headerLevel >= minHeader and headerLevel <= maxHeader %} + {% if headerAttrs %} + {% capture _hAttrToStrip %}{{ _hAttrToStrip | split: '>' | first }} {{ headerAttrs | replace: '%heading%', escaped_header | replace: '%html_id%', html_id }}>{% endcapture %} + {% endif %} + + {% capture anchor %}href="#{{ html_id }}"{% endcapture %} + + {% if include.anchorClass %} + {% capture anchor %}{{ anchor }} class="{{ include.anchorClass }}"{% endcapture %} + {% endif %} + + {% if include.anchorTitle %} + {% capture anchor %}{{ anchor }} title="{{ include.anchorTitle | replace: '%heading%', escaped_header }}"{% endcapture %} + {% endif %} + + {% if include.anchorAttrs %} + {% capture anchor %}{{ anchor }} {{ include.anchorAttrs | replace: '%heading%', escaped_header | replace: '%html_id%', html_id }}{% endcapture %} + {% endif %} + + {% capture anchor %}{{ include.anchorBody | replace: '%heading%', escaped_header | default: '' }}{% endcapture %} + + + {% if beforeHeading %} + {% capture anchor %}{{ anchor }} {% endcapture %} + {% else %} + {% capture anchor %} {{ anchor }}{% endcapture %} + {% endif %} + {% endif %} + + {% capture new_heading %} + + {% endcapture %} + + + {% assign chunkCount = _workspace | size %} + {% if chunkCount > 1 %} + {% capture new_heading %}{{ new_heading }}{{ _workspace | last }}{% endcapture %} + {% endif %} + + {% capture edited_headings %}{{ edited_headings }}{{ new_heading }}{% endcapture %} + {% endfor %} +{% endcapture %}{% assign headingsWorkspace = '' %}{{ edited_headings | strip }} diff --git a/_layouts/default.html b/_layouts/default.html index 751e0dcc..7796462a 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -12,7 +12,7 @@ {% endif %}
    - {{ content }} + {% include anchor_headings.html html=content anchorBody="#" %}
    From 7f57b0faef4040a0e6eb1b1b411b5d8c339ec092 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Wed, 10 Aug 2022 16:57:25 +0300 Subject: [PATCH 115/206] H4 for see also, as our H5 is smaller than Lean's. --- learn/glossary.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learn/glossary.md b/learn/glossary.md index ce4ed2fb..31d308b6 100644 --- a/learn/glossary.md +++ b/learn/glossary.md @@ -33,6 +33,6 @@ Distinguishing between whether a document is normative or not is intended to cla JSON Schema's normative documents notably include its [specification](https://json-schema.org/specification.html). This page for instance, not being a normative document, is not able to proscribe new JSON Schema behavior not already covered by the specification. -##### See also +#### See also * [normative](https://developer.mozilla.org/en-US/docs/Glossary/Normative) and [non-normative](https://developer.mozilla.org/en-US/docs/Glossary/non-normative) in the Mozilla Glossary, and its links From 9783f12ccecc19784c7fe9c27e03a6796fe78c99 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Fri, 12 Aug 2022 13:40:40 +0300 Subject: [PATCH 116/206] Add glossary entries for schema and instance. --- learn/glossary.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/learn/glossary.md b/learn/glossary.md index 31d308b6..0b585c7a 100644 --- a/learn/glossary.md +++ b/learn/glossary.md @@ -24,6 +24,15 @@ While future drafts may introduce new behavior or changes to existing behavior, The current list of drafts can be found [here](https://json-schema.org/specification-links.html#published-drafts). +### instance + +A piece of JSON data which is to be validated by a [schema](#schema). + +JSON Schema can be used to validate JSON values of any type (as well as values from many JSON-like formats which can be reasonably represented as JSON). + +The JSON Schema specification makes no broad assumptions about the structure of instances themselves beyond those of the JSON specification itself. +In particular it does not reserve any properties within a JSON object for its own use, or require parsers of JSON to support features beyond those already mandated of JSON implementations. + ### normative In the context of JSON Schema, and formal specifications more broadly, a document which outlines standardized behavior. @@ -36,3 +45,13 @@ This page for instance, not being a normative document, is not able to proscribe #### See also * [normative](https://developer.mozilla.org/en-US/docs/Glossary/Normative) and [non-normative](https://developer.mozilla.org/en-US/docs/Glossary/non-normative) in the Mozilla Glossary, and its links + +### schema + +A document, written according to the proscribed structure of the JSON Schema specification, which can be used to validate [instances](#instance). + +The rules constituting what schemas are *valid* JSON Schemas, as well as the rules governing their behavior when validating instances, are defined by the JSON Schema specification. + +Strictly speaking, according to the specification, schemas are themselves JSON documents, though it is somewhat common for them to be authored or maintained in other languages which are easily translated to JSON, such as YAML. + +In recent [drafts](#draft) of the specification, a schema is either a JSON object or a JSON boolean value. From 5a15c9930b03f3fc0a17e867449d4efdf641d694 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Mon, 15 Aug 2022 13:39:07 +0100 Subject: [PATCH 117/206] Fix using `type` rather than `$ref` in 2020-12 release notes Some schemas in the 2020-12 release notes used `type` rather than `$ref` where the value was clearly a relative reference URI. https://groups.google.com/g/json-schema/c/v1fwFPA2PFU?pli=1 --- draft/2020-12/release-notes.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/draft/2020-12/release-notes.md b/draft/2020-12/release-notes.md index e4fb5c2b..7fad89da 100644 --- a/draft/2020-12/release-notes.md +++ b/draft/2020-12/release-notes.md @@ -350,8 +350,8 @@ external references that we want to bundle. "properties": { "address": { "type": "string" }, "city": { "type": "string" }, - "postalCode": { "type": "/schema/common#/$defs/usaPostalCode" }, - "state": { "type": "/$defs/states" } + "postalCode": { "$ref": "/schema/common#/$defs/usaPostalCode" }, + "state": { "$ref": "/$defs/states" } }, "$defs": { @@ -407,8 +407,8 @@ embedded schemas using `$defs`. Here's what the bundled schema would look like. "properties": { "address": { "type": "string" }, "city": { "type": "string" }, - "postalCode": { "type": "/schema/common#/$defs/usaPostalCode" }, - "state": { "type": "#/$defs/states" } + "postalCode": { "$ref": "/schema/common#/$defs/usaPostalCode" }, + "state": { "$ref": "#/$defs/states" } }, "$defs": { From 30f0b15730faba6c8147ae647c0ce6a68cb1f5a6 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Fri, 19 Aug 2022 13:27:24 -0700 Subject: [PATCH 118/206] Fix local build error --- Gemfile | 1 + Gemfile.lock | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Gemfile b/Gemfile index 37f5eaa4..d74d7c0d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,2 +1,3 @@ source 'https://rubygems.org' gem 'github-pages', group: :jekyll_plugins +gem 'webrick', '~> 1.7' diff --git a/Gemfile.lock b/Gemfile.lock index a406fa2a..94427aa0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -251,6 +251,7 @@ GEM unf_ext unf_ext (0.0.8.2) unicode-display_width (1.8.0) + webrick (1.7.0) zeitwerk (2.6.0) PLATFORMS @@ -258,6 +259,7 @@ PLATFORMS DEPENDENCIES github-pages + webrick (~> 1.7) BUNDLED WITH 2.2.7 From aa96d4b08ab1d4210ea15d52007986bf1c4e5977 Mon Sep 17 00:00:00 2001 From: boneyao Date: Mon, 22 Aug 2022 09:08:01 +0800 Subject: [PATCH 119/206] Java Implementation update Vert.x Json Schema, jsonschemafriend, networknt/json-schema-validator implement 2020-12 --- _data/validator-libraries-modern.yml | 39 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index ca0a2517..ea2303bb 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -109,19 +109,31 @@ notes: includes custom validator support, rich error returns - name: Java implementations: - - name: Snow - url: https://github.com/ssilverman/snowy-json - notes: Uses Maven for the project and Gson under the hood. - date-draft: [2019-09] - draft: [7, 6] - license: GNU Affero General Public License v3.0 - name: Vert.x Json Schema url: https://github.com/eclipse-vertx/vertx-json-schema notes: Validator for Eclipse Vert.x project JSON types. - date-draft: [2019-09] + date-draft: [2020-12, 2019-09] draft: [7] license: Apache License, Version 2.0 notes: includes custom keywords support, custom dialect support, asynchronous validation + - name: jsonschemafriend + url: https://github.com/jimblackler/jsonschemafriend + notes: + date-draft: [2020-12, 2019-09] + draft: [7, 6, 4, 3] + license: Apache License 2.0 + - name: networknt/json-schema-validator + url: https://github.com/networknt/json-schema-validator + notes: Support OpenAPI 3.0 with Jackson parser + date-draft: [2020-12, 2019-09] + draft: [7, 6, 4] + license: Apache License 2.0 + - name: Snow + url: https://github.com/ssilverman/snowy-json + notes: Uses Maven for the project and Gson under the hood. + date-draft: [2019-09] + draft: [7, 6] + license: GNU Affero General Public License v3.0 - name: everit-org/json-schema url: https://github.com/everit-org/json-schema notes: @@ -134,18 +146,7 @@ date-draft: draft: [7, 6, 4] license: Apache License 2.0 - - name: networknt/json-schema-validator - url: https://github.com/networknt/json-schema-validator - notes: Support OpenAPI 3.0 with Jackson parser - date-draft: [2019-09] - draft: [7, 6, 4] - license: Apache License 2.0 - - name: jsonschemafriend - url: https://github.com/jimblackler/jsonschemafriend - notes: - date-draft: [2019-09] - draft: [7, 6, 4, 3] - license: Apache License 2.0 + - name: Kotlin implementations: - name: Medeia-validator From 33b89001486e434d7dbd2e8a8de78e92c2ce5a1c Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 22 Aug 2022 08:58:23 +1200 Subject: [PATCH 120/206] sort implementations by most recent draft support --- _data/validator-libraries-modern.yml | 79 ++++++++++++++-------------- 1 file changed, 39 insertions(+), 40 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 005de682..58d7f6ec 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -1,16 +1,16 @@ - name: .NET anchor-name: dotnet implementations: - - name: Json.NET Schema - url: https://www.newtonsoft.com/jsonschema - date-draft: [2019-09] - draft: [7, 6, 4, 3] - license: "AGPL-3.0-only" - name: JsonSchema.Net url: https://github.com/gregsdennis/json-everything date-draft: [2020-12, 2019-09] draft: [7, 6] license: MIT + - name: Json.NET Schema + url: https://www.newtonsoft.com/jsonschema + date-draft: [2019-09] + draft: [7, 6, 4, 3] + license: "AGPL-3.0-only" - name: C implementations: - name: WJElement @@ -71,17 +71,17 @@ license: LGPL - name: Elixir implementations: + - name: JsonXema + url: https://github.com/hrzndhrn/json_xema + date-draft: + draft: [7, 6, 4] + license: MIT - name: Elixir JSON Schema validator url: https://github.com/jonasschmidt/ex_json_schema date-draft: draft: [4] notes: "Draft-06+ progress: issue [24](https://github.com/jonasschmidt/ex_json_schema/issues/24); branch [multi-draft-support](https://github.com/jonasschmidt/ex_json_schema/tree/multi-draft-support)" license: MIT - - name: JsonXema - url: https://github.com/hrzndhrn/json_xema - date-draft: - draft: [7, 6, 4] - license: MIT - name: Erlang implementations: - name: JeSSE @@ -90,11 +90,6 @@ license: "Apache 2.0" - name: Go implementations: - - name: gojsonschema - url: https://github.com/xeipuuv/gojsonschema - date-draft: - draft: [7, 6, 4] - license: "Apache 2.0" - name: santhosh-tekuri/jsonschema url: https://github.com/santhosh-tekuri/jsonschema notes: includes custom keywords, output formats @@ -107,6 +102,11 @@ draft: [7] license: MIT notes: includes custom validator support, rich error returns + - name: gojsonschema + url: https://github.com/xeipuuv/gojsonschema + date-draft: + draft: [7, 6, 4] + license: "Apache 2.0" - name: Java implementations: - name: Vert.x Json Schema @@ -146,7 +146,6 @@ date-draft: draft: [7, 6, 4] license: Apache License 2.0 - - name: Kotlin implementations: - name: Medeia-validator @@ -166,22 +165,22 @@ license: MIT - name: JavaScript implementations: + - name: Hyperjump JSV + url: https://github.com/jdesrosiers/json-schema + notes: "Built for Node.js and browsers. Includes support for custom vocabularies." + date-draft: [2019-09, 2020-12] + draft: [7, 6, 4] + license: MIT - name: ajv url: https://github.com/ajv-validator/ajv notes: "for Node.js and browsers - supports [user-defined keywords](https://github.com/ajv-validator/ajv/blob/master/docs/keywords.md) and [$data reference](https://github.com/json-schema-org/json-schema-spec/issues/51)" date-draft: [2019-09, 2020-12] draft: [7, 6, 4] license: MIT - - name: djv - url: https://github.com/korzio/djv - notes: "for Node.js and browsers" - date-draft: - draft: [6, 4] - license: MIT - - name: Hyperjump JSV - url: https://github.com/jdesrosiers/json-schema - notes: "Built for Node.js and browsers. Includes support for custom vocabularies." - date-draft: [2019-09, 2020-12] + - name: "@cfworker/json-schema" + url: https://github.com/cfworker/cfworker/blob/master/packages/json-schema/README.md + notes: "Built for Cloudflare workers, browsers, and Node.js" + date-draft: [2019-09] draft: [7, 6, 4] license: MIT - name: JSON Schema Library @@ -190,17 +189,17 @@ date-draft: draft: [7, 6, 4] license: MIT + - name: djv + url: https://github.com/korzio/djv + notes: "for Node.js and browsers" + date-draft: + draft: [6, 4] + license: MIT - name: vue-vuelidate-jsonschema url: https://github.com/mokkabonna/vue-vuelidate-jsonschema date-draft: draft: [6] license: MIT - - name: "@cfworker/json-schema" - url: https://github.com/cfworker/cfworker/blob/master/packages/json-schema/README.md - notes: "Built for Cloudflare workers, browsers, and Node.js" - date-draft: [2019-09] - draft: [7, 6, 4] - license: MIT - name: Perl implementations: - name: JSON::Schema::Modern @@ -322,7 +321,7 @@ url: https://json-everything.net date-draft: [2020-12, 2019-09] draft: [7, 6] - notes: Powered by JsonSchema.Net; server-side validation + notes: Powered by JsonSchema.Net in Blazor WASM for client-side validation - name: jsonschema.dev url: https://jsonschema.dev draft: [7] @@ -351,12 +350,6 @@ url: 'https://www.npmjs.com/package/ajv-cli' date-draft: draft: [7, 6, 4] - - name: Polyglottal JSON Schema Validator - license: MIT - url: 'https://www.npmjs.com/package/pajv' - date-draft: - draft: [6, 4] - notes: can be used with YAML and many other formats besides JSON - name: yajsv license: MIT url: 'https://github.com/neilpa/yajsv' @@ -368,4 +361,10 @@ url: 'https://www.json-buddy.com/json-validator-command-line-tool.htm' date-draft: draft: [2019-09, 7, 6, 4] - notes: JSONBuddy cli tool. Windows platform. Support for large data and streaming validation. \ No newline at end of file + notes: JSONBuddy cli tool. Windows platform. Support for large data and streaming validation. + - name: Polyglottal JSON Schema Validator + license: MIT + url: 'https://www.npmjs.com/package/pajv' + date-draft: + draft: [6, 4] + notes: can be used with YAML and many other formats besides JSON From ee7eaf0cab1483d7fbf5a594b62b8b605f34f41d Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 22 Aug 2022 09:23:28 +1200 Subject: [PATCH 121/206] move impls with no draft-6 or later support to obsolete --- _data/validator-libraries-modern.yml | 16 +--------------- _data/validator-libraries-obsolete.yml | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 58d7f6ec..e2a0a024 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -11,14 +11,6 @@ date-draft: [2019-09] draft: [7, 6, 4, 3] license: "AGPL-3.0-only" -- name: C - implementations: - - name: WJElement - url: https://github.com/netmail-open/wjelement - date-draft: - draft: [4, 3] - license: LGPL-3.0 - notes: "Draft-06+ progress: issue [17](https://github.com/netmail-open/wjelement/issues/17#issuecomment-390899432)" - name: C++ implementations: - name: f5-json-schema @@ -67,7 +59,7 @@ - name: json-schema url: https://github.com/fisxoj/json-schema date-draft: [2019-09] - draft: [4, 6, 7] + draft: [7, 6, 4] license: LGPL - name: Elixir implementations: @@ -76,12 +68,6 @@ date-draft: draft: [7, 6, 4] license: MIT - - name: Elixir JSON Schema validator - url: https://github.com/jonasschmidt/ex_json_schema - date-draft: - draft: [4] - notes: "Draft-06+ progress: issue [24](https://github.com/jonasschmidt/ex_json_schema/issues/24); branch [multi-draft-support](https://github.com/jonasschmidt/ex_json_schema/tree/multi-draft-support)" - license: MIT - name: Erlang implementations: - name: JeSSE diff --git a/_data/validator-libraries-obsolete.yml b/_data/validator-libraries-obsolete.yml index 6cc5bd40..952b28ce 100644 --- a/_data/validator-libraries-obsolete.yml +++ b/_data/validator-libraries-obsolete.yml @@ -11,6 +11,14 @@ date-draft: [2019-09] draft: [7, 6, 4] license: MIT +- name: C + implementations: + - name: WJElement + url: https://github.com/netmail-open/wjelement + date-draft: + draft: [4, 3] + license: LGPL-3.0 + notes: "Draft-06+ progress: issue [17](https://github.com/netmail-open/wjelement/issues/17#issuecomment-390899432)" - name: C++ anchor-name: cpp implementations: @@ -53,6 +61,14 @@ notes: draft: [4] license: BSL-1.0 +- name: Elixir + implementations: + - name: Elixir JSON Schema validator + url: https://github.com/jonasschmidt/ex_json_schema + date-draft: + draft: [4] + notes: "Draft-06+ progress: issue [24](https://github.com/jonasschmidt/ex_json_schema/issues/24); branch [multi-draft-support](https://github.com/jonasschmidt/ex_json_schema/tree/multi-draft-support)" + license: MIT - name: Go implementations: - name: validate-json From 6127552790d5ccf69351f708ef1793016f8dce78 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 22 Aug 2022 11:39:57 +1200 Subject: [PATCH 122/206] add a note for C-lang now missing an impl --- _data/validator-libraries-modern.yml | 2 ++ implementations.md | 3 +++ 2 files changed, 5 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index e2a0a024..82bfb332 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -11,6 +11,8 @@ date-draft: [2019-09] draft: [7, 6, 4, 3] license: "AGPL-3.0-only" +- name: C + notes: All known implementations are now obsolete. - name: C++ implementations: - name: f5-json-schema diff --git a/implementations.md b/implementations.md index a6799cbc..7b6eba77 100644 --- a/implementations.md +++ b/implementations.md @@ -40,6 +40,9 @@ Validators {% for language in validator-libraries %}
  • {{language.name}} + {% if language.notes %} + {{ implementation.notes }} + {% endif %}
      {% for implementation in language.implementations %}
    • From d500e001257afcdd89645698baf0a4c6be9d05e1 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 22 Aug 2022 14:29:19 +1200 Subject: [PATCH 123/206] move valbuddy up --- _data/validator-libraries-modern.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 82bfb332..f23522c5 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -333,6 +333,12 @@ draft: [7] - name: Command Line implementations: + - name: valbuddy + license: Free and commercial versions (proprietary) + url: 'https://www.json-buddy.com/json-validator-command-line-tool.htm' + date-draft: + draft: [2019-09, 7, 6, 4] + notes: JSONBuddy cli tool. Windows platform. Support for large data and streaming validation. - name: ajv-cli license: MIT url: 'https://www.npmjs.com/package/ajv-cli' @@ -344,12 +350,6 @@ date-draft: draft: [7, 6, 4] notes: wraps [xeipuuv/gojsonschema](https://github.com/xeipuuv/gojsonschema) - - name: valbuddy - license: Free and commercial versions (proprietary) - url: 'https://www.json-buddy.com/json-validator-command-line-tool.htm' - date-draft: - draft: [2019-09, 7, 6, 4] - notes: JSONBuddy cli tool. Windows platform. Support for large data and streaming validation. - name: Polyglottal JSON Schema Validator license: MIT url: 'https://www.npmjs.com/package/pajv' From 1b3f0f3a4dbf50862ac069a66f751b6738f7fbd4 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 22 Aug 2022 15:35:22 +1200 Subject: [PATCH 124/206] a few more updates --- _data/validator-libraries-modern.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index f23522c5..47b225b2 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -12,7 +12,7 @@ draft: [7, 6, 4, 3] license: "AGPL-3.0-only" - name: C - notes: All known implementations are now obsolete. + notes: No known implementations support draft-06 or later. - name: C++ implementations: - name: f5-json-schema @@ -310,10 +310,6 @@ date-draft: [2020-12, 2019-09] draft: [7, 6] notes: Powered by JsonSchema.Net in Blazor WASM for client-side validation - - name: jsonschema.dev - url: https://jsonschema.dev - draft: [7] - notes: Powered by ajv; client-side validation - name: jschon.dev url: https://jschon.dev/ date-draft: [2020-12, 2019-09] @@ -323,6 +319,10 @@ date-draft: [2019-09] draft: [7, 6, 4, 3] notes: Powered by JSON.Net; server-side validation + - name: jsonschema.dev + url: https://jsonschema.dev + draft: [7] + notes: Powered by ajv; client-side validation - name: JSON Schema Lint url: http://jsonschemalint.com/ date-draft: From 57b87d4e7f495dc2a6d382f13507c54480940774 Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Fri, 19 Aug 2022 12:48:22 -0700 Subject: [PATCH 125/206] Warn people about AJV's noncompliant strict mode. --- _data/validator-libraries-modern.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 47b225b2..8188421d 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -161,7 +161,7 @@ license: MIT - name: ajv url: https://github.com/ajv-validator/ajv - notes: "for Node.js and browsers - supports [user-defined keywords](https://github.com/ajv-validator/ajv/blob/master/docs/keywords.md) and [$data reference](https://github.com/json-schema-org/json-schema-spec/issues/51)" + notes: "for Node.js and browsers - supports [user-defined keywords](https://github.com/ajv-validator/ajv/blob/master/docs/keywords.md) and [$data reference](https://github.com/json-schema-org/json-schema-spec/issues/51); _Only specification-compliant when strict mode is **disabled.**_" date-draft: [2019-09, 2020-12] draft: [7, 6, 4] license: MIT From 0d8017b48afe4f0431b0b1bc1eb2c44a3f675abf Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Mon, 22 Aug 2022 22:19:50 -0700 Subject: [PATCH 126/206] Add link to how to turn off AJV's strict mode --- _data/validator-libraries-modern.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 8188421d..db9bce97 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -161,7 +161,7 @@ license: MIT - name: ajv url: https://github.com/ajv-validator/ajv - notes: "for Node.js and browsers - supports [user-defined keywords](https://github.com/ajv-validator/ajv/blob/master/docs/keywords.md) and [$data reference](https://github.com/json-schema-org/json-schema-spec/issues/51); _Only specification-compliant when strict mode is **disabled.**_" + notes: "for Node.js and browsers - supports [user-defined keywords](https://github.com/ajv-validator/ajv/blob/master/docs/keywords.md) and [$data reference](https://github.com/json-schema-org/json-schema-spec/issues/51); _Only specification-compliant when [strict mode](https://ajv.js.org/strict-mode.html) is **disabled.**_" date-draft: [2019-09, 2020-12] draft: [7, 6, 4] license: MIT From a0c4a67b206df186a185c7e03861ca58addfd8f2 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Sun, 28 Aug 2022 12:41:20 +0300 Subject: [PATCH 127/206] Add glossary entries for keyword and meta-schema. --- learn/glossary.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/learn/glossary.md b/learn/glossary.md index 0b585c7a..94f1afbc 100644 --- a/learn/glossary.md +++ b/learn/glossary.md @@ -24,6 +24,12 @@ While future drafts may introduce new behavior or changes to existing behavior, The current list of drafts can be found [here](https://json-schema.org/specification-links.html#published-drafts). +### keyword + +A property appearing within a [schema](#schema) object. + +The [JSON Schema specification](https://json-schema.org/specification.html) defines behavior for a large library of keywords which can be used to describe [instances](#instance). + ### instance A piece of JSON data which is to be validated by a [schema](#schema). @@ -33,6 +39,15 @@ JSON Schema can be used to validate JSON values of any type (as well as values f The JSON Schema specification makes no broad assumptions about the structure of instances themselves beyond those of the JSON specification itself. In particular it does not reserve any properties within a JSON object for its own use, or require parsers of JSON to support features beyond those already mandated of JSON implementations. +### meta-schema + +A [schema](#schema) which is itself intended to describe other *schemas*. + +JSON Schema defines a language for describing any [instance](#instance) using a schema written in JSON. +Since schemas are themselves JSON values, they may be opaquely treated as *instances*, and therefore described by other schemas. + +We refer to the schema-of-a-schema as a "meta-schema" to express this use. + ### normative In the context of JSON Schema, and formal specifications more broadly, a document which outlines standardized behavior. From d6e3a4899366dbd73d8f1a9a43c7b5c6c0f4a759 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Sun, 28 Aug 2022 12:41:46 +0300 Subject: [PATCH 128/206] Loosen the verbiage around the schema<->instance interaction in the glossary. --- learn/glossary.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/learn/glossary.md b/learn/glossary.md index 94f1afbc..8cbbda00 100644 --- a/learn/glossary.md +++ b/learn/glossary.md @@ -32,9 +32,9 @@ The [JSON Schema specification](https://json-schema.org/specification.html) defi ### instance -A piece of JSON data which is to be validated by a [schema](#schema). +A piece of JSON data which is to be described by a [schema](#schema). -JSON Schema can be used to validate JSON values of any type (as well as values from many JSON-like formats which can be reasonably represented as JSON). +JSON Schema can be used to describe JSON values of any type (as well as values from many JSON-like formats which can be reasonably represented as JSON). The JSON Schema specification makes no broad assumptions about the structure of instances themselves beyond those of the JSON specification itself. In particular it does not reserve any properties within a JSON object for its own use, or require parsers of JSON to support features beyond those already mandated of JSON implementations. @@ -63,9 +63,9 @@ This page for instance, not being a normative document, is not able to proscribe ### schema -A document, written according to the proscribed structure of the JSON Schema specification, which can be used to validate [instances](#instance). +A document, written according to the proscribed structure of the JSON Schema specification, which can be used to describe [instances](#instance). -The rules constituting what schemas are *valid* JSON Schemas, as well as the rules governing their behavior when validating instances, are defined by the JSON Schema specification. +The rules constituting which schemas are conformant, as well as the rules governing their behavior when validating instances, are defined by the [JSON Schema specification](https://json-schema.org/specification.html). Strictly speaking, according to the specification, schemas are themselves JSON documents, though it is somewhat common for them to be authored or maintained in other languages which are easily translated to JSON, such as YAML. From 75ec41479f39e55d8e8e850c7beb1197ef8a7a1c Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Mon, 29 Aug 2022 11:46:18 -0700 Subject: [PATCH 129/206] Sort languages and drafts automatically Several languages and date drafts were out of order. Fix it in code instead of trying to keep the data file consistent. --- _data/validator-libraries-modern.yml | 10 ++++++---- implementations.md | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index db9bce97..89302900 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -193,12 +193,14 @@ - name: JSON::Schema::Modern url: https://github.com/karenetheridge/JSON-Schema-Modern notes: - date-draft: [7, 2019-09, 2020-12] + date-draft: [2019-09, 2020-12] + draft: [7] license: "GNU General Public License, Version 1 + The Artistic License 1.0" - name: JSON::Schema::Tiny url: https://github.com/karenetheridge/JSON-Schema-Tiny notes: - date-draft: [7, 2019-09, 2020-12] + date-draft: [2019-09, 2020-12] + draft: [7] license: "GNU General Public License, Version 1 + The Artistic License 1.0" - name: JSON::Validator url: https://github.com/mojolicious/json-validator @@ -336,8 +338,8 @@ - name: valbuddy license: Free and commercial versions (proprietary) url: 'https://www.json-buddy.com/json-validator-command-line-tool.htm' - date-draft: - draft: [2019-09, 7, 6, 4] + date-draft: [2019-09] + draft: [7, 6, 4] notes: JSONBuddy cli tool. Windows platform. Support for large data and streaming validation. - name: ajv-cli license: MIT diff --git a/implementations.md b/implementations.md index 7b6eba77..c7e35057 100644 --- a/implementations.md +++ b/implementations.md @@ -26,7 +26,7 @@ Validators
    • {% endif %} + {% if implementation.last-updated %} +
    • Information last updated: + {{ implementation.last-updated }} +
    • + {% endif %} +
  • {% endfor %} @@ -338,6 +344,13 @@ Hyper-Schema ({{ implementation.license | join: ", " }}) {% endif %} + {% if implementation.last-updated %} +
    + Information last updated: + {{ implementation.last-updated }} + {% endif %} + + {% endfor %} From f6158efbd446235d88ee2f8dfef7f682e52085d7 Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Mon, 29 Aug 2022 21:35:18 -0700 Subject: [PATCH 135/206] Add a compliance section to the impl data This adds a structured section on compliance, specifically how to configure for it. This is *not* intended to be the same sort of compliance information that the test suite provides. Rather, it is about things that implementations document that don't necessarily show up in test suite results. This format includes brief instructions and optionally (ideally) a documentation link. I think this langauge is appropriately neutral, and particularly when there is a doc link it feels more like calling attention to something that is already advertised rather than being judgemental. The AJV and Opis cases are straightfoward. The Common Lisp implementation's case of needing to disable automatic downloading is worth a bit of thought as that is a SHOULD NOT rather than a MUST NOT, but this is why the schema description notes that it is the _most_ compliant config, and other configs may still be compliant. Similary, the networknt Java implementation having `nullable` on by default is not technically non-compliant, but it is more compliant to not have it. There may be other compliance configuration changes that need documenting, but these were the ones that I could find with a reasonable amount of effort. --- _data/schema.yml | 48 ++++++++++++++++++++++++++++ _data/validator-libraries-modern.yml | 23 ++++++++++++- implementations.md | 11 +++++++ 3 files changed, 81 insertions(+), 1 deletion(-) diff --git a/_data/schema.yml b/_data/schema.yml index a1e65f2e..bb696653 100644 --- a/_data/schema.yml +++ b/_data/schema.yml @@ -95,6 +95,8 @@ $defs: Additional information. Overly promotional (or critical) wording should be avoided. type: string + compliance: + $ref: "#/$defs/compliance" last-updated: description: | The date (in whatever timezone was relevant at the time) @@ -108,3 +110,49 @@ $defs: type: string format: date pattern: '^\d\d\d\d-[01]\d-[0123]\d$' + compliance: + description: | + The compliance section notes aspects of an implementation's + _default configuration_ that are non-compliant with the + specification in ways that are _not necessarily_ detected + by the test suite. This information is provided based on + implementation documentation. + type: object + unevaluatedProperties: false + properties: + constraints: + description: | + A brief note of design constraints that impacted choices + regarding compliance. This includes things like + targeting memory-constrained environments, or trading + off features for performance. It does not include + opinions regarding the value (or lack thereof) of + the specification requirements. + type: string + config: + description: | + Documents how to configure an implementation to produce + the most specification-compliant behavior if it does + not do so by default. The resulting configuration + may still have incomplete compliance (such as not + having implemented all keywords), but will not + have additional behavior that contradicts the + specification (such as modifying the instance + by filling in default values). + type: object + unevaluatedProperties: false + required: [instructions] + properties: + docs: + description: | + A link to the implementation's configuration + documentation, ideally to whatever part addresses + configuration and compliance. + type: string + format: uri + instructions: + description: | + Instructions to configure for compliance. Will + appear in a sentence after "you must" and before + "to produce specification-compliant behavior." + type: string diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index ea67caf0..db785618 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -73,6 +73,11 @@ date-draft: [2019-09] draft: [7, 6, 4] license: LGPL + compliance: + config: + docs: https://github.com/fisxoj/json-schema/blob/master/README.rst + instructions: | + set `resolve-remote-references` to `nil` last-updated: "2022-08-31" - name: Elixir implementations: @@ -134,6 +139,10 @@ date-draft: [2020-12, 2019-09] draft: [7, 6, 4] license: Apache License 2.0 + compliance: + config: + docs: https://github.com/networknt/json-schema-validator/blob/master/doc/config.md + instructions: "set `handleNullableField` to `false`" last-updated: "2022-08-31" - name: Snow url: https://github.com/ssilverman/snowy-json @@ -165,10 +174,14 @@ last-updated: "2022-08-31" - name: ajv url: https://github.com/ajv-validator/ajv - notes: "for Node.js and browsers - supports [user-defined keywords](https://github.com/ajv-validator/ajv/blob/master/docs/keywords.md) and [$data reference](https://github.com/json-schema-org/json-schema-spec/issues/51); _Only specification-compliant when [strict mode](https://ajv.js.org/strict-mode.html) is **disabled.**_" + notes: "for Node.js and browsers - supports [user-defined keywords](https://github.com/ajv-validator/ajv/blob/master/docs/keywords.md) and [$data reference](https://github.com/json-schema-org/json-schema-spec/issues/51)" date-draft: [2019-09, 2020-12] draft: [7, 6, 4] license: MIT + compliance: + config: + docs: https://ajv.js.org/strict-mode.html + instructions: "set option `strict: false`" last-updated: "2022-08-31" - name: "@cfworker/json-schema" url: https://github.com/cfworker/cfworker/blob/master/packages/json-schema/README.md @@ -249,6 +262,10 @@ date-draft: [2020-12, 2019-09] draft: [7, 6] license: "Apache License 2.0" + compliance: + config: + docs: https://opis.io/json-schema/2.x/php-loader.html#parser-options + instructions: 'set several options to their "vanilla" values' last-updated: "2022-08-31" - name: Swaggest Json Schema url: https://github.com/swaggest/php-json-schema @@ -386,6 +403,10 @@ url: 'https://www.npmjs.com/package/ajv-cli' date-draft: [2020-12, 2019-09] draft: [7, 6, 4] + compliance: + config: + docs: https://github.com/ajv-validator/ajv-cli#ajv-options + instructions: "pass `--strict=false`" last-updated: "2022-08-31" - name: yajsv license: MIT diff --git a/implementations.md b/implementations.md index fc65be59..90d4aff0 100644 --- a/implementations.md +++ b/implementations.md @@ -57,6 +57,17 @@ Validators {% endif %} + {% if implementation.compliance %} +
  • Compliance: + {% if implementation.compliance.config.docs %} + This implementation documents that you must + {% endif %} + {% if implementation.compliance.config.instructions %} + {{ implementation.compliance.config.instructions | markdownify | remove: '

    ' | remove: '

    ' }}
    to produce specification-compliant behavior. +
  • + {% endif %} + {% endif %} + {% if implementation.license %}
  • License: {{ implementation.license | join: ", " }} From ebdd0b57fca34030709a4de418c7d11b8bb7b1da Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Wed, 31 Aug 2022 14:11:36 -0700 Subject: [PATCH 136/206] Add built-on field Some implementations, particularly but not exclusively CLI and web ones, are implemented on top of other validator libraries. This adds a structured field to account for that, and updates all known cases where it is relevant. It was necessary to also support an anchor-name field for implementations as with programming languages, and in the process disambiguate a few duplicate names. --- _data/schema.yml | 41 ++++++++++++++++++++++------ _data/validator-libraries-modern.yml | 41 ++++++++++++++++++++++------ implementations.md | 9 +++++- 3 files changed, 74 insertions(+), 17 deletions(-) diff --git a/_data/schema.yml b/_data/schema.yml index bb696653..43a2cdb9 100644 --- a/_data/schema.yml +++ b/_data/schema.yml @@ -31,12 +31,8 @@ $defs: oneOf: - required: [implementations] - required: [notes] + $ref: "#/$defs/name-and-anchor-name" properties: - name: - type: string - anchor-name: - type: string - description: A name suitable for us as an HTML id. implementations: description: | The list of implementations for this language/environment, @@ -55,6 +51,30 @@ $defs: required: [last-updated] notes: type: [string, "null"] + name-and-anchor-name: + $comment: | + Require an anchor-name if the name is not suitable for + use as an anchor (HTML id attribute) + if: + required: [name] + not: + properties: + name: + $ref: "#/$defs/anchor-name" + then: + required: [anchor-name] + properties: + name: + type: string + anchor-name: + $ref: "#/$defs/anchor-name" + anchor-name: + description: | + A name suitable for us as an HTML id, if the regular name + is not a vald id. The regex is looser than the HTML spec + but is based on what was already working on the page. + type: string + pattern: '^[A-Za-z][A-Za-z0-9+-_:./ ()]*$' implementation: description: | An implementation and its associated information. @@ -64,10 +84,8 @@ $defs: anyOf: - required: [draft] - required: [date-draft] + $ref: "#/$defs/name-and-anchor-name" properties: - name: - description: The human-friendly name of the implementation - type: string url: description: | The URL of the implementation's repository or documentation @@ -95,6 +113,13 @@ $defs: Additional information. Overly promotional (or critical) wording should be avoided. type: string + built-on: + description: | + Indicates that this implementation is built on another + implementation, typically to make it available through + a web page, CLI, or a different programming language. + type: object + $ref: "#/$defs/name-and-anchor-name" compliance: $ref: "#/$defs/compliance" last-updated: diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index db785618..aaf6455e 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -52,7 +52,7 @@ draft: [7] license: MIT last-updated: "2022-08-31" - - name: json-schema + - name: json-schema (luposlip) url: https://github.com/luposlip/json-schema date-draft: [] draft: [4, 6, 7] @@ -61,6 +61,7 @@ - name: COM/ActiveX implementations: - name: JSON Essentials for COM/ActiveX + anchor-name: JSONEssentials url: https://pinery.systems/json-essentials-com/index.html draft: [7] license: proprietary @@ -68,7 +69,7 @@ last-updated: "2022-08-31" - name: Common Lisp implementations: - - name: json-schema + - name: json-schema (fisxoj) url: https://github.com/fisxoj/json-schema date-draft: [2019-09] draft: [7, 6, 4] @@ -135,7 +136,7 @@ last-updated: "2022-08-31" - name: networknt/json-schema-validator url: https://github.com/networknt/json-schema-validator - notes: Support OpenAPI 3.0 with Jackson parser + notes: Support OpenAPI 3.0 with Jackson parser date-draft: [2020-12, 2019-09] draft: [7, 6, 4] license: Apache License 2.0 @@ -184,6 +185,7 @@ instructions: "set option `strict: false`" last-updated: "2022-08-31" - name: "@cfworker/json-schema" + anchor-name: cfworker url: https://github.com/cfworker/cfworker/blob/master/packages/json-schema/README.md notes: "Built for Cloudflare workers, browsers, and Node.js" date-draft: [2019-09] @@ -294,11 +296,13 @@ draft: [7, 6, 4] license: BSD-3-Clause last-updated: "2022-08-31" - - name: jsonschema-rs + - name: jsonschema-rs (Python) url: https://github.com/Stranger6667/jsonschema-rs/tree/master/bindings/python notes: Python bindings to Rust's jsonschema crate date-draft: [] draft: [7, 6, 4] + built-on: + name: jsonschema-rs license: MIT last-updated: "2022-08-31" - name: Ruby @@ -351,43 +355,59 @@ last-updated: "2022-08-31" - name: Web (Online) implementations: - - name: Hyperjump JSV + - name: Hyperjump JSV (online) url: https://json-schema.hyperjump.io date-draft: [2020-12, 2019-09] draft: [7, 6, 4] notes: Supports multiple schemas and multiple instances; client-side validation + built-on: + name: Hyperjump JSV last-updated: "2022-08-31" - name: json-everything url: https://json-everything.net date-draft: [2020-12, 2019-09] draft: [7, 6] notes: Powered by JsonSchema.Net in Blazor WASM for client-side validation + built-on: + name: JsonSchema.Net last-updated: "2022-08-31" - name: jschon.dev url: https://jschon.dev/ date-draft: [2020-12, 2019-09] draft: [] + built-on: + name: jschon last-updated: "2022-08-31" - name: JSON Schema Validator url: https://www.jsonschemavalidator.net/ date-draft: [2019-09] draft: [7, 6, 4, 3] - notes: Powered by JSON.Net; server-side validation + notes: server-side validation + built-on: + name: Json.NET Schema last-updated: "2022-08-31" - name: jsonschema.dev url: https://jsonschema.dev draft: [7] - notes: Powered by ajv; client-side validation + notes: client-side validation + built-on: + name: ajv last-updated: "2022-08-31" - name: JSON Schema Lint url: http://jsonschemalint.com/ date-draft: [] draft: [7, 6, 4, 3, 2, 1] + built-on: + name: ajv + notes: Uses JSV for draft-03 and earlier last-updated: "2022-08-31" - name: ExtendsClass's JSON Schema Validator + anchor-name: ExtendsClass url: https://extendsclass.com/json-schema-validator.html date-draft: [] draft: [7] + built-on: + name: ajv last-updated: "2022-08-31" - name: Command Line implementations: @@ -407,13 +427,16 @@ config: docs: https://github.com/ajv-validator/ajv-cli#ajv-options instructions: "pass `--strict=false`" + built-on: + name: ajv last-updated: "2022-08-31" - name: yajsv license: MIT url: 'https://github.com/neilpa/yajsv' date-draft: [] draft: [7, 6, 4] - notes: wraps [xeipuuv/gojsonschema](https://github.com/xeipuuv/gojsonschema) + built-on: + name: gojsonschema last-updated: "2022-08-31" - name: Polyglottal JSON Schema Validator license: MIT @@ -422,3 +445,5 @@ draft: [6, 4] notes: can be used with YAML and many other formats besides JSON last-updated: "2022-08-31" + built-on: + name: ajv diff --git a/implementations.md b/implementations.md index 90d4aff0..d9356576 100644 --- a/implementations.md +++ b/implementations.md @@ -46,7 +46,8 @@ Validators
      {% for implementation in language.implementations %}
    • - {{ implementation.name }} + + {{ implementation.name }}
      • Supports: {% if implementation.date-draft %} @@ -68,6 +69,12 @@ Validators {% endif %} {% endif %} + {% if implementation.built-on %} +
      • Built on: + {{ implementation.built-on.name }} +
      • + {% endif %} + {% if implementation.license %}
      • License: {{ implementation.license | join: ", " }} From 1e7b146243f5f2426f99eb2f24b44e6e05002f1f Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Wed, 31 Aug 2022 18:55:05 -0700 Subject: [PATCH 137/206] Update ajv-cli, validate implementations data This updates ajv-cli and changes it to use the current syntax to validate everything under 2020-12. I'm not sure why it was using draft-07 for the learn/examples schemas as they declare 2020-12. --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 724b3497..886aa1a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,10 @@ sudo: false node_js: - node before_script: -- npm install ajv-cli@3.1.0 +- npm install ajv-cli@5.0.0 ajv-formats@2.1.1 - PATH="./node_modules/.bin/:$PATH" script: - bundle exec jekyll build -- ajv test -s draft-07/schema -d "learn/examples/*.json" --valid --add-used-schema=false +- ajv compile --spec=draft2020 --strict=false -s learn/examples/geographical-location.schema.json -s learn/examples/address.schema.json -s learn/examples/card.schema.json -s learn/examples/calendar.schema.json +- ajv compile --spec=draft2020 --strict=false -c ajv-formats -s _data/schema.yml +- ajv --spec=draft2020 --strict=false -c ajv-formats test -s _data/schema.yml -d "_data/*-libraries-*.yml" --valid From 723f3212710f5e7eaca54f6b681a58dfb70c086c Mon Sep 17 00:00:00 2001 From: Jim Crist-Harif Date: Wed, 14 Sep 2022 15:36:58 -0500 Subject: [PATCH 138/206] Add msgspec to implementations --- implementations.md | 1 + 1 file changed, 1 insertion(+) diff --git a/implementations.md b/implementations.md index e6034160..92aae02c 100644 --- a/implementations.md +++ b/implementations.md @@ -155,6 +155,7 @@ For example, the only incompatibilities between draft-04 and draft-06 involve `e - [typescript-json-schema](https://github.com/YousefED/typescript-json-schema) - Python - [Pydantic](https://pydantic-docs.helpmanual.io/) (MIT) - generates schemas from Python models based on Python 3.6+ type hints. + - [msgspec](https://jcristharif.com/msgspec/) (BSD-3-Clause) - generates schemas from Python type annotations. - Java - [jsonschema-generator](https://github.com/victools/jsonschema-generator) (Apache 2.0) - generates schemas from Java types *supports Draft 7 and Draft 2019-09* - Scala From 2ced0f2c2ddf9e277674d1ccdabd3dd23400976f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Sep 2022 02:20:58 +0000 Subject: [PATCH 139/206] Bump commonmarker from 0.23.5 to 0.23.6 Bumps [commonmarker](https://github.com/gjtorikian/commonmarker) from 0.23.5 to 0.23.6. - [Release notes](https://github.com/gjtorikian/commonmarker/releases) - [Changelog](https://github.com/gjtorikian/commonmarker/blob/main/CHANGELOG.md) - [Commits](https://github.com/gjtorikian/commonmarker/compare/v0.23.5...v0.23.6) --- updated-dependencies: - dependency-name: commonmarker dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 94427aa0..ce7c576b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -14,7 +14,7 @@ GEM execjs coffee-script-source (1.11.1) colorator (1.1.0) - commonmarker (0.23.5) + commonmarker (0.23.6) concurrent-ruby (1.1.10) dnsruby (1.61.9) simpleidn (~> 0.1) From bcf15746137770483a74285caa488f157749855d Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Sat, 24 Sep 2022 10:00:09 -0700 Subject: [PATCH 140/206] Trigger site publishing after master->main rename From c3b7cb9a15dbceda7e1789ac63eb23456eaf0495 Mon Sep 17 00:00:00 2001 From: DJ Adams Date: Thu, 29 Sep 2022 07:26:04 +0000 Subject: [PATCH 141/206] fix specification reference links Looks like the doc fragment links in json-schema-core and json-schema-validation changed, so fixing the references, in this super useful getting started doc (thanks, btw!). --- learn/getting-started-step-by-step.md | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/learn/getting-started-step-by-step.md b/learn/getting-started-step-by-step.md index 5c2e51d5..5e299de1 100644 --- a/learn/getting-started-step-by-step.md +++ b/learn/getting-started-step-by-step.md @@ -50,10 +50,10 @@ We start with four properties called **keywords** which are expressed as [JSON]( > Yes. the standard uses a JSON data document to describe data documents, most often that are also JSON data documents but could be in any number of other content types like `text/xml`. -* The [`$schema`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.1) keyword states that this schema is written according to a specific draft of the standard and used for a variety of reasons, primarily version control. -* The [`$id`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.1) keyword defines a URI for the schema, and the base URI that other URI references within the schema are resolved against. -* The [`title`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) and [`description`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) annotation keywords are descriptive only. They do not add constraints to the data being validated. The intent of the schema is stated with these two keywords. -* The [`type`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.1) validation keyword defines the first constraint on our JSON data and in this case it has to be a JSON Object. +* The [`$schema`](https://json-schema.org/draft/2020-12/json-schema-core.html#section-8.1.1) keyword states that this schema is written according to a specific draft of the standard and used for a variety of reasons, primarily version control. +* The [`$id`](https://json-schema.org/draft/2020-12/json-schema-core.html#section-8.2.1) keyword defines a URI for the schema, and the base URI that other URI references within the schema are resolved against. +* The [`title`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-9.1) and [`description`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-9.1) annotation keywords are descriptive only. They do not add constraints to the data being validated. The intent of the schema is stated with these two keywords. +* The [`type`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.1.1) validation keyword defines the first constraint on our JSON data and in this case it has to be a JSON Object. ```json { @@ -67,9 +67,9 @@ We start with four properties called **keywords** which are expressed as [JSON]( We introduce the following pieces of terminology when we start the schema: -* [Schema Keyword](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.1): `$schema` and `$id`. -* [Schema Annotations](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1): `title` and `description`. -* [Validation Keyword](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.1): `type`. +* [Schema Keyword](https://json-schema.org/draft/2020-12/json-schema-core.html#section-8.1.1): `$schema` and `$id`. +* [Schema Annotations](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-9.1): `title` and `description`. +* [Validation Keyword](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.1.1): `type`. ## Defining the properties @@ -77,10 +77,10 @@ We introduce the following pieces of terminology when we start the schema: In JSON Schema terms, we update our schema to add: -* The [`properties`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.1) validation keyword. +* The [`properties`](https://json-schema.org/draft/2020-12/json-schema-core.html#section-10.3.2.1) validation keyword. * The `productId` key. * `description` schema annotation and `type` validation keyword is noted -- we covered both of these in the previous section. -* The [`required`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.5.3) validation keyword listing `productId`. +* The [`required`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.5.3) validation keyword listing `productId`. ```json @@ -130,8 +130,8 @@ In JSON Schema terms, we update our schema to add: According to the store owner there are no free products. ;) * The `price` key is added with the usual `description` schema annotation and `type` validation keywords covered previously. It is also included in the array of keys defined by the `required` validation keyword. -* We specify the value of `price` must be something other than zero using the [`exclusiveMinimum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.5) validation keyword. - * If we wanted to include zero as a valid price we would have specified the [`minimum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.4) validation keyword. +* We specify the value of `price` must be something other than zero using the [`exclusiveMinimum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.2.5) validation keyword. + * If we wanted to include zero as a valid price we would have specified the [`minimum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.2.4) validation keyword. ```json { @@ -172,9 +172,9 @@ Therefore: * The `tags` key is added with the usual annotations and keywords. * This time the `type` validation keyword is `array`. -* We introduce the [`items`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.1.2) validation keyword so we can define what appears in the array. In this case: `string` values via the `type` validation keyword. -* The [`minItems`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.2) validation keyword is used to make sure there is at least one item in the array. -* The [`uniqueItems`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.3) validation keyword notes all of the items in the array must be unique relative to one another. +* We introduce the [`items`](https://json-schema.org/draft/2020-12/json-schema-core.html#section-10.3.1.2) validation keyword so we can define what appears in the array. In this case: `string` values via the `type` validation keyword. +* The [`minItems`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.4.2) validation keyword is used to make sure there is at least one item in the array. +* The [`uniqueItems`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.4.3) validation keyword notes all of the items in the array must be unique relative to one another. * We did not add this key to the `required` validation keyword array because it is optional. ```json @@ -276,7 +276,7 @@ So far our JSON schema has been wholly self contained. It is very common to shar For this example we introduce a new JSON Schema resource and for both properties therein: * We use the `minimum` validation keyword noted earlier. -* We add the [`maximum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.2) validation keyword. +* We add the [`maximum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.2.2) validation keyword. * Combined, these give us a range to use in validation. ```json From 7ea91eb034b44c3578d1b0c7049643dd7e6a2be5 Mon Sep 17 00:00:00 2001 From: DJ Adams Date: Thu, 29 Sep 2022 07:48:18 +0000 Subject: [PATCH 142/206] fix spec links in file-system learning resource --- learn/file-system.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/learn/file-system.md b/learn/file-system.md index da7630b9..0544e423 100644 --- a/learn/file-system.md +++ b/learn/file-system.md @@ -66,16 +66,16 @@ We will start with a base JSON Schema expressing the following constraints: Building out our JSON Schema from top to bottom: -* The [`$id`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.1) keyword. -* The [`$schema`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.1) keyword. -* The [`type`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.1) validation keyword. -* The [`required`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.5.3) validation keyword. -* The [`properties`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.1) validation keyword. +* The [`$id`](https://json-schema.org/draft/2020-12/json-schema-core.html#section-8.2.1) keyword. +* The [`$schema`](https://json-schema.org/draft/2020-12/json-schema-core.html#section-8.1.1) keyword. +* The [`type`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.1.1) validation keyword. +* The [`required`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.5.3) validation keyword. +* The [`properties`](https://json-schema.org/draft/2020-12/json-schema-core.html#section-10.3.2.1) validation keyword. * The `/` key is empty now; We will fill it out later. -* The [`patternProperties`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.2) validation keyword. +* The [`patternProperties`](https://json-schema.org/draft/2020-12/json-schema-core.html#section-10.3.2.2) validation keyword. * This matches other property names via a regular expression. Note: it does not match `/`. * The `^(/[^/]+)+$` key is empty now; We will fill it out later. -* The [`additionalProperties`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.3) validation keyword. +* The [`additionalProperties`](https://json-schema.org/draft/2020-12/json-schema-core.html#section-10.3.2.3) validation keyword. * The value here is `false` to constrain object properties to be either `/` or to match the regular expression. > You will notice that the regular expression is explicitly anchored (with `^` and `$`): in JSON Schema, regular expressions (in `patternProperties` and in `pattern`) are not anchored by default. @@ -104,11 +104,11 @@ We saw these keywords in the prior exercise: `$id`, `$schema`, `type`, `required To this we add: -* The [`description`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.1) annotation keyword. -* The [`oneOf`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.2.1.3) keyword. -* The [`$ref`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.3.1) keyword. +* The [`description`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-9.1) annotation keyword. +* The [`oneOf`](https://json-schema.org/draft/2020-12/json-schema-core.html#section-10.2.1.3) keyword. +* The [`$ref`](https://json-schema.org/draft/2020-12/json-schema-core.html#section-8.2.3.1) keyword. * In this case, all references used are local to the schema using a relative fragment URI (`#/...`). -* The [`$defs`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.4) keyword. +* The [`$defs`](https://json-schema.org/draft/2020-12/json-schema-core.html#section-8.2.4) keyword. * Including several key names which we will define later. ```json @@ -142,12 +142,12 @@ To this we add: Let's now extend this skeleton to add constraints to some of the properties. -* Our `fstype` key uses the [`enum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.2) validation keyword. +* Our `fstype` key uses the [`enum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.1.2) validation keyword. * Our `options` key uses the following: * The `type` validation keyword (see above). - * The [`minItems`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.2) validation keyword. - * The [`items`](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.1.2) validation keyword. - * The [`uniqueItems`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.3) validation keyword. + * The [`minItems`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.4.2) validation keyword. + * The [`items`](https://json-schema.org/draft/2020-12/json-schema-core.html#section-10.3.1.2) validation keyword. + * The [`uniqueItems`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.4.3) validation keyword. * Together these say: `options` must be an array, and the items therein must be strings, there must be at least one item, and all items should be unique. * We have a `readonly` key. @@ -198,7 +198,7 @@ With these added constraints, the schema now looks like this: One new keyword is introduced here: -* The [`pattern`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.3.3) validation keyword notes the `device` key must be an absolute path starting with */dev*. +* The [`pattern`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.3.3) validation keyword notes the `device` key must be an absolute path starting with */dev*. ```json { @@ -246,7 +246,7 @@ We do have a new key: `label` and the `pattern` validation keyword states it mus We find another new keyword: -* The [`format`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.7) annotation and assertion keyword. +* The [`format`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-7) annotation and assertion keyword. ```json { @@ -276,8 +276,8 @@ We find another new keyword: Our last definition introduces two new keywords: -* The [`minimum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.4) validation keyword. -* The [`maximum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.2) validation keyword. +* The [`minimum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.2.4) validation keyword. +* The [`maximum`](https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.2.2) validation keyword. * Together these require the size be between 16 and 512, inclusive. ```json From b420f375bc1867553d93c278923d611d35627d23 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Thu, 29 Sep 2022 08:56:00 +0100 Subject: [PATCH 143/206] Update schedule for our open community meetings And add link to calendar --- index.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.md b/index.md index df042724..3b64e05c 100644 --- a/index.md +++ b/index.md @@ -41,8 +41,10 @@ We hold weekly Office Hours and twice monthly Open Community Working Meetings. Office Hours are every first Tuesday of the month at 15:00 UTC, and by appointment. -Open Community Working Meetings are every First and Third Monday of the month at 14:00 PT. +Open Community Working Meetings are every Monday at 14:00 PT. +If either of these are cancelled or moved for any reason, we will aim to announce such via the Slack announcement channel and Twitter. +See our [community calendar](https://calendar.google.com/calendar/u/0/embed?src=c_8r4g9r3etmrmt83fm2gljbatos@group.calendar.google.com) (and make sure to check the time zone). ## Need more? @@ -110,6 +112,7 @@ Similarly to most specifications, the JSON schema specification will continue to When the _draft_ designation is dropped this may indicate that the frequency of releases and amount of changes in each release will decrease, but it won't indicate that no new releases will be made, or that all future releases will be backwards compatible. + ## Quickstart The JSON document being validated or described we call the *instance*, and the document containing the description is called the *schema*. From a822bf3be51e19e25367ad9c9d440413beee4273 Mon Sep 17 00:00:00 2001 From: Kurt McKee Date: Thu, 29 Sep 2022 08:14:48 -0500 Subject: [PATCH 144/206] Fix a whitespace typo --- specification.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification.md b/specification.md index e70419a9..742d633c 100644 --- a/specification.md +++ b/specification.md @@ -30,7 +30,7 @@ They are also available on the IETF main site: Meta-schemas ------------ -The meta-schemas are schemas against which other schemas can be validated.It is self-descriptive: the JSON Schema meta-schema validates itself. +The meta-schemas are schemas against which other schemas can be validated. It is self-descriptive: the JSON Schema meta-schema validates itself. The latest meta-schema is **2020-12**. For an explanation of the change to date-based identifiers, see the [Specification Links](specification-links.html) page. From 2aa6daaa828c85ece632439b884f2105e01f23d7 Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Sat, 1 Oct 2022 20:34:04 -0700 Subject: [PATCH 145/206] Announce several things about process changes This addresses some of the most commonly-heard questions and misconceptions about our recent process announcement. --- index.md | 44 ++++++++++---------------------------------- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/index.md b/index.md index 3b64e05c..be134af2 100644 --- a/index.md +++ b/index.md @@ -20,6 +20,16 @@ permalink: / +## Announcements and Feedback Solicitation: Specification Process + +* The JSON Schema media types (`application/schema+json` and `application/schema-instance+json`) will be published as an [IETF RFC](https://datatracker.ietf.org/doc/draft-ietf-httpapi-rest-api-mediatypes/), which has already been adopted by the HTTP APIs working group. +* As an [Incubation-status OpenJS Foundation project](https://openjsf.org/projects/#incubating), we continue to work through our governance [todo list](https://github.com/json-schema-org/community/issues/129) to move to either At-Large or Impact status. +* The bulk of our specification will be published under a new process currently [under public discussion](https://github.com/orgs/json-schema-org/discussions/234). All are encouraged to provide feedback! Our goals with this process include: + * In the next release, offer stability guarantees for long-stable aspects of JSON Schema. + * Provide clarity regarding which other aspects are close to a stable form, and which are more experimental. + * Publish our specifications in a way similar to OpenAPI and AsyncAPI, which are also part of the Linux Foundation (the larger umbrella under which the OpenJS Foundation exists). +* We are working on finding the right path for Relative JSON Pointer to reach standardization in the near future. An IETF RFC currently remains the most likely path, although several details are still being worked out. + ## What now? Learn, Get help, Shape the Community, Chat, with the JSON Schema team and Community! @@ -79,40 +89,6 @@ so we will usually refer to `2020-12` (without the word "draft") on this web sit See the [Specification page](specification.html) for details about naming and numbering. -### The Path to Standardization - -The JSON Schema project intends to shepherd all three draft series to either: RFC status, the equivalent within another standards body, and/or join a foundation and establish self publication rules. - -
        -Read more - -Currently, we are continuing to improve our self-published Internet-Drafts. We are not actively pursuing joining a standards organisation. - -We have a few contacts related to each potential path, but if you have experience with such things and would like to help, please still contact us! - -In the meantime, publication of Internet-Draft documents can be tracked through the IETF: -* [JSON Schema (core)](https://datatracker.ietf.org/doc/draft-bhutton-json-schema/) -* [JSON Schema Validation](https://datatracker.ietf.org/doc/draft-bhutton-json-schema-validation/) -* [Relative JSON Pointers](https://datatracker.ietf.org/doc/draft-bhutton-relative-json-pointer/) - -Internet-Drafts expire after six months, so our goal is to publish often enough to always have a set of unexpired drafts available. There may be brief gaps as we wrap up each draft and finalize the text. -
        - -### Use of the _draft_ designation -Releases of the JSON schema specification and meta schemas use the _draft_ designation primarily for historical reasons stemming from the relationship of this specification to IETF ([explained here](https://json-schema.org/specification-links.html#understanding-draft-names-and-numbers)). -The use of this designation is under review but will continue until this review process completes to avoid changing the designation style multiple times. -
        -Read more - -The JSON schema project recognizes, condones, and advocates for the use of the JSON schema standard in production. - -Each release of the JSON schema specification is treated as a production release by the JSON schema project. All changes in each new release are made judiciously, with great care, thorough review and careful consideration of how the changes will impact existing users and implementations of the JSON schema specification. - -Similarly to most specifications, the JSON schema specification will continue to evolve, and not all releases will be backwards compatible. The intention, particularly for vocabularies such as validation which have been widely implemented, is to remain as compatible as possible from release to release. However, major changes can still occur given a clear enough need validated with the user community. - -When the _draft_ designation is dropped this may indicate that the frequency of releases and amount of changes in each release will decrease, but it won't indicate that no new releases will be made, or that all future releases will be backwards compatible. -
        - ## Quickstart The JSON document being validated or described we call the *instance*, and the document containing the description is called the *schema*. From c76c6771a6df418dfc0e70af8b13dbdee3c1df41 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Tue, 4 Oct 2022 14:37:01 +0100 Subject: [PATCH 146/206] Fix office hours time! --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index 3b64e05c..84fcfde3 100644 --- a/index.md +++ b/index.md @@ -39,7 +39,7 @@ We hold weekly Office Hours and twice monthly Open Community Working Meetings. 👷 Open Community Working Meetings -Office Hours are every first Tuesday of the month at 15:00 UTC, and by appointment. +Office Hours are every first Tuesday of the month at 15:00 BST, and by appointment. Open Community Working Meetings are every Monday at 14:00 PT. From 537e4ee29c5b1296b7b25fb124244fb07cb429b0 Mon Sep 17 00:00:00 2001 From: Michael Mior Date: Tue, 4 Oct 2022 11:24:31 -0400 Subject: [PATCH 147/206] Add JSONoid to implementations --- implementations.md | 1 + 1 file changed, 1 insertion(+) diff --git a/implementations.md b/implementations.md index 92aae02c..54a3c251 100644 --- a/implementations.md +++ b/implementations.md @@ -169,6 +169,7 @@ For example, the only incompatibilities between draft-04 and draft-06 involve `e - [saasquatch/json-schema-inferrer](https://github.com/saasquatch/json-schema-inferrer) _draft-07, -06, -04_ (Apache 2.0) - Java library for inferring JSON Schemas from one or multiple JSON samples. - Scala - [Schema Guru](https://github.com/snowplow/schema-guru) (Apache 2.0) - CLI util, Spark Job and Web UI for deriving JSON Schemas out of corpus of JSON instances; see issue [178](https://github.com/snowplow/schema-guru/issues/178) for progress towards draft-06+ support + - [JSONoid](https://github.com/michaelmior/jsonoid-discovery/) (MIT) - command line tool and Spark application for inferring schemas from JSON documents, supports draft 2019-09 - Clojure - [luposlip/json-schema](https://github.com/luposlip/json-schema) (Apache 2.0) - infer JSON Schema from Clojure data - Online (web tool) From 2705881a6b8a43c5b011915a777c29088894a32d Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Thu, 6 Oct 2022 00:27:21 +0100 Subject: [PATCH 148/206] Link directly to json-everything.net's validator --- _data/validator-libraries-modern.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index aaf6455e..fe9725ff 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -364,7 +364,7 @@ name: Hyperjump JSV last-updated: "2022-08-31" - name: json-everything - url: https://json-everything.net + url: https://json-everything.net/json-schema date-draft: [2020-12, 2019-09] draft: [7, 6] notes: Powered by JsonSchema.Net in Blazor WASM for client-side validation From 9ae616e7ab0eaed7afd3c68ce1e2b725c334fbf8 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 7 Oct 2022 12:07:30 +0200 Subject: [PATCH 149/206] Add go-jsonschema --- implementations.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/implementations.md b/implementations.md index 92aae02c..84705166 100644 --- a/implementations.md +++ b/implementations.md @@ -195,6 +195,8 @@ are the only keywords that changed. - Elm - [json-schema-to-elm](https://github.com/dragonwasrobot/json-schema-to-elm) - generates Elm types, JSON decoders+encoders, and fuzz tests from one or more JSON Schema files, using [dragonwasrobot/json_schema](https://github.com/dragonwasrobot/json_schema) *supports Draft 7* +- Go + - [go-jsonschema](https://git.sr.ht/~emersion/go-jsonschema) - generates Go types and helpers from JSON schema files *supports Draft 2020-12* - Java - [jsonCodeGen](https://github.com/schlothauer-wauer/jsoncodegen) (MIT) - Groovy based generation tasks from JSON schema. Already includes templates/generators for Java Beans, Swagger specification files and PlantUML diagrams. - [jsonschema2pojo](https://github.com/joelittlejohn/jsonschema2pojo) (Apache 2.0) - generates Java types from JSON Schema (or example JSON) and can annotate those types for data-binding with Jackson 2.x or Gson. *draft-07* From 2f0f2ff5372340d18361cc9024b7bf6658908788 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Tue, 11 Oct 2022 11:50:18 +0000 Subject: [PATCH 150/206] Add glossary entries for dialect and vocabulary. --- learn/glossary.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/learn/glossary.md b/learn/glossary.md index 6ffd5392..8f0cc815 100644 --- a/learn/glossary.md +++ b/learn/glossary.md @@ -14,6 +14,15 @@ If you encounter a term you wish were defined here, please feel free to [file an The entries on this page can be linked to via anchor links (e.g. `https://json-schema.org/learn/glossary.html#vocabulary`) when sharing a definition with others. +### dialect + +A collection of [vocabularies](#vocabulary), along with an indication of whether supporting each vocabulary is required to process schemas written in the dialect. + +Dialects are identified by a URI, which [schemas](#schema) may then reference in their `$schema` [keyword](#keyword). +Doing so identifies the schema as being written in the dialect, and thereby indicates which keywords are usable within it, along with their intended meaning. + +The JSON Schema specification [defines](https://json-schema.org/specification.html#general-purpose-meta-schema) a number of dialects, each of which enable vocabularies suitable for the dialect's specific use case. + ### draft An individual release of the JSON Schema specification. @@ -70,3 +79,18 @@ The rules constituting which schemas are conformant, as well as the rules govern Strictly speaking, according to the specification, schemas are themselves JSON documents, though it is somewhat common for them to be authored or maintained in other languages which are easily translated to JSON, such as YAML. In recent [drafts](#draft) of the specification, a schema is either a JSON object or a JSON boolean value. + +### vocabulary + +A collection of related [keywords](keyword), grouped to facilitate re-use. + +A vocabulary typically includes both a [meta-schema](#meta-schema) which formally defines the keywords it contains, as well as a prose document or specification which explains the semantics of its keywords in a way suitable for implementers and users of the vocabulary. + +Anyone can create and publish a vocabulary, and implementations generally will include facilities for extending themselves with support for additional vocabularies and their keywords. +The JSON Schema specification includes a number of vocabularies which cover each of the keywords it defines. + +Vocabularies are identified by a URI which may be referenced via the `$vocabulary` keyword in order to enable the vocabulary within a [dialect](#dialect). + +#### See also + +* [`json-schema-vocabularies`](https://github.com/json-schema-org/json-schema-vocabularies), a repository which collects known third-party JSON Schema vocabularies From fe3f20bf46a7abc3b6427e49af1af35aa4f83446 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Wed, 12 Oct 2022 15:56:49 +0000 Subject: [PATCH 151/206] The vocabulary document is considered authoritative. --- learn/glossary.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/learn/glossary.md b/learn/glossary.md index 8f0cc815..1fd68007 100644 --- a/learn/glossary.md +++ b/learn/glossary.md @@ -84,7 +84,8 @@ In recent [drafts](#draft) of the specification, a schema is either a JSON objec A collection of related [keywords](keyword), grouped to facilitate re-use. -A vocabulary typically includes both a [meta-schema](#meta-schema) which formally defines the keywords it contains, as well as a prose document or specification which explains the semantics of its keywords in a way suitable for implementers and users of the vocabulary. +A vocabulary is specified by a prose document or specification which explains the semantics of its keywords in a way suitable for implementers and users of the vocabulary. +It often also includes a [meta-schema](#meta-schema) (or multiple metaschemas) which define the syntax of its keywords. Anyone can create and publish a vocabulary, and implementations generally will include facilities for extending themselves with support for additional vocabularies and their keywords. The JSON Schema specification includes a number of vocabularies which cover each of the keywords it defines. From 67002b6e20c1f745b74115caaccce06e8b9ef3a5 Mon Sep 17 00:00:00 2001 From: Octavian Date: Wed, 19 Oct 2022 15:59:02 +0300 Subject: [PATCH 152/206] Update implementations.md - Updated Oxygen JSON Schema editor description - Added XSD to JSON schema converter - Added Oxygen Documentation generator --- implementations.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/implementations.md b/implementations.md index 121eb8d5..22015395 100644 --- a/implementations.md +++ b/implementations.md @@ -293,6 +293,9 @@ the utility, and decided on a case-by-case basis. - Webpack - [@cloudflare/json-schema-ref-loader](https://github.com/cloudflare/json-schema-tools/tree/master/workspaces/json-schema-ref-loader) ([JSON Schema Tools](https://github.com/cloudflare/json-schema-tools)), (BSD-3-Clause) Webpack loader for dereference-able schemas in JSON, JSON5, YAML, or JavaScript - [@cloudflare/json-schema-apidoc-loader](https://github.com/cloudflare/json-schema-tools/tree/master/workspaces/json-schema-apidoc-loader) ([JSON Schema Tools](https://github.com/cloudflare/json-schema-tools)), Back-end for [@cloudflare/doca](https://github.com/cloudflare/json-schema-tools/tree/master/workspaces/doca), _draft-04, -06, -07, and Doca extensions_ +- XSD + - [Oxygen XSD to JSON Schema](https://www.oxygenxml.com/json_converter.html#xsd-to-json-schema) - Generate from an XSD file a similar JSON Schema structure. + - [XSD to JSON Schema IntellJ plugin](https://plugins.jetbrains.com/plugin/19024-xsd-to-json-schema) - Plugin for converting an XML Schema (XSD) file to a JSON Schema file. #### Testing @@ -307,7 +310,7 @@ the utility, and decided on a case-by-case basis. - [JSONBuddy](https://www.json-buddy.com/) - *Text and grid-style JSON editor and validator with JSON schema analyzer, context sensitive entry-helpers and sample data generation based on JSON schema. Support for draft-4, draft-6, draft-7 and 2019-09. JSON Schema validation debugger: Step through the validation process and set breakpoints.* - [JSONEditor Online](https://jsoneditoronline.org/) - *View, edit, format, and validate JSON online* Support draft-4, draft-6, and draft-7. - [Liquid JSON Schema Editor](https://www.liquid-technologies.com/json-schema-editor) - *Graphical JSON Schema editor for draft-04, draft-06, draft-07 and 2019-09, with split source code and grphical editing. Includes validation of JSON files based on JSON Schema, JSON Sample Generator and JSON Schema Documentation Generator.* -- [Oxygen JSON Editor](https://www.oxygenxml.com/xml_editor/json.html) - *JSON editor with a variety of editing features and helper views. Support for validation and editing JSON Schema draft-4, draft-6, and draft-7. Validation and editing of JSON files based on JSON Schema.* +- [Oxygen JSON Schema Editor](https://www.oxygenxml.com/xml_developer/json_schema_editor.html) - *JSON Schema editor with a variety of editing features and helper views (Design/Text/Author). Support for validation and editing JSON Schema draft-4, draft-6, and draft-7, 2019-09, 2020-12. Validation and editing of JSON files based on JSON Schema.* - [Perseid Modeler](https://www.datensen.com/data-modeling/perseid-modeler-for-json-schema.html) - *a modeling tool for JSON Schema and OpenAPI. Key features include: visual JSON schema creation using tree and ERD-like diagrams, support for JSON schema structures including operators and conditions, import of existing schemas from files, creation of detailed HTML reports, export to PDF, script generation, and more. Supported versions: draft 4, 6, 7, 2019-09 and 2020-12* - [Stoplight Studio](https://stoplight.io/) - *JSON Schema IDE (text-based and GUI) with support for JSON/YAML linting, which can also be based on JSON Schema rules via Spectral. Support for draft-4, draft-6 and draft-7.* - [Visual Studio Code](https://code.visualstudio.com/) - *Schema driven code completion, hovers and validation for editing JSON files (including schemas)* @@ -319,6 +322,7 @@ the utility, and decided on a case-by-case basis. - [jsonschematic](https://github.com/yanick/jsonschematic/) - Svelte-based schema viewer. Runs as a local web app. Supports draft-7. - [docson](https://github.com/lbovet/docson) - Javascript-based schema viewer. Runs as a local web app. Supports draft-4. - [json-schema-for-humans](https://pypi.org/project/json-schema-for-humans/) - Generate HTML representation of a schema. Python-based. Supports draft-7. +- [oXygen JSON Schema Documentation](https://www.oxygenxml.com/json_converter.html#generate-json-schema-documentation) - Generate JSON Schema documentation in HTML format including diagrams. - [wetzel](https://github.com/CesiumGS/wetzel) - Generates Markdown and AsciiDoc. With some limitations, supports draft-3, draft-4, draft-7, and 2020-12. Schema Repositories From 3d0a123bfcce2928f654d0db77c66485c16e5b6f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Oct 2022 03:39:16 +0000 Subject: [PATCH 153/206] Bump nokogiri from 1.13.6 to 1.13.9 Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.6 to 1.13.9. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.13.6...v1.13.9) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index ce7c576b..4cf839f2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -212,7 +212,7 @@ GEM jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) minitest (5.16.1) - nokogiri (1.13.6) + nokogiri (1.13.9) mini_portile2 (~> 2.8.0) racc (~> 1.4) octokit (4.25.0) From 5cabad53abf871e0362056b0f78ab77a08cb5724 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Thu, 3 Nov 2022 14:43:09 +0000 Subject: [PATCH 154/206] Updated primer Opened in favour of https://github.com/json-schema-org/json-schema-org.github.io/pull/423 --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index 0755d820..e276482b 100644 --- a/index.md +++ b/index.md @@ -5,7 +5,7 @@ permalink: / --- -**JSON Schema** is a vocabulary that allows you to **annotate** and **validate** JSON documents. +**JSON Schema** is a declarative domain specific language that allows you to **annotate** and **validate** JSON documents. JSON Schema enables the confident and reliable use of the JSON data format. ## Benefits From 4fd1feef51659b36f7edc6dd9fccd306c65c80e6 Mon Sep 17 00:00:00 2001 From: Octavian Date: Fri, 4 Nov 2022 08:42:32 +0200 Subject: [PATCH 155/206] Update implementations.md Updated the description for Oxygen JSON Schema implementation 2019-09 and 2020-12 --- implementations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implementations.md b/implementations.md index 22015395..6aa68b33 100644 --- a/implementations.md +++ b/implementations.md @@ -310,7 +310,7 @@ the utility, and decided on a case-by-case basis. - [JSONBuddy](https://www.json-buddy.com/) - *Text and grid-style JSON editor and validator with JSON schema analyzer, context sensitive entry-helpers and sample data generation based on JSON schema. Support for draft-4, draft-6, draft-7 and 2019-09. JSON Schema validation debugger: Step through the validation process and set breakpoints.* - [JSONEditor Online](https://jsoneditoronline.org/) - *View, edit, format, and validate JSON online* Support draft-4, draft-6, and draft-7. - [Liquid JSON Schema Editor](https://www.liquid-technologies.com/json-schema-editor) - *Graphical JSON Schema editor for draft-04, draft-06, draft-07 and 2019-09, with split source code and grphical editing. Includes validation of JSON files based on JSON Schema, JSON Sample Generator and JSON Schema Documentation Generator.* -- [Oxygen JSON Schema Editor](https://www.oxygenxml.com/xml_developer/json_schema_editor.html) - *JSON Schema editor with a variety of editing features and helper views (Design/Text/Author). Support for validation and editing JSON Schema draft-4, draft-6, and draft-7, 2019-09, 2020-12. Validation and editing of JSON files based on JSON Schema.* +- [Oxygen JSON Schema Editor](https://www.oxygenxml.com/xml_developer/json_schema_editor.html) - *JSON Schema editor with a variety of editing features and helper views (Design/Text/Author). Support for validation and editing JSON Schema draft-4, draft-6, and draft-7, 2019-09 (partial), 2020-12 (partial). Validation and editing of JSON files based on JSON Schema.* - [Perseid Modeler](https://www.datensen.com/data-modeling/perseid-modeler-for-json-schema.html) - *a modeling tool for JSON Schema and OpenAPI. Key features include: visual JSON schema creation using tree and ERD-like diagrams, support for JSON schema structures including operators and conditions, import of existing schemas from files, creation of detailed HTML reports, export to PDF, script generation, and more. Supported versions: draft 4, 6, 7, 2019-09 and 2020-12* - [Stoplight Studio](https://stoplight.io/) - *JSON Schema IDE (text-based and GUI) with support for JSON/YAML linting, which can also be based on JSON Schema rules via Spectral. Support for draft-4, draft-6 and draft-7.* - [Visual Studio Code](https://code.visualstudio.com/) - *Schema driven code completion, hovers and validation for editing JSON files (including schemas)* From 1f8bd34dc8014e3c17d4e53d66a52e296e2ddc98 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Wed, 9 Nov 2022 11:07:19 -0500 Subject: [PATCH 156/206] Update the link for python-jsonschema (It now lives in a GitHub organization, though the old link redirects.) --- _data/validator-libraries-modern.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index fe9725ff..a5229060 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -284,11 +284,11 @@ license: MIT last-updated: "2022-08-31" - name: jsonschema - url: https://github.com/Julian/jsonschema + url: https://github.com/python-jsonschema/jsonschema date-draft: [2019-09, 2020-12] draft: [7, 6, 4, 3] license: "MIT" - last-updated: "2022-08-31" + last-updated: "2022-11-09" - name: fastjsonschema url: https://github.com/horejsek/python-fastjsonschema notes: Great performance thanks to code generation. From 645fd3cf9e23bded416d315ab84efc356b83167d Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Mon, 14 Nov 2022 10:51:45 +0000 Subject: [PATCH 157/206] Remove "domain specific" --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index e276482b..44c03f0c 100644 --- a/index.md +++ b/index.md @@ -5,7 +5,7 @@ permalink: / --- -**JSON Schema** is a declarative domain specific language that allows you to **annotate** and **validate** JSON documents. JSON Schema enables the confident and reliable use of the JSON data format. +**JSON Schema** is a declarative language that allows you to **annotate** and **validate** JSON documents. JSON Schema enables the confident and reliable use of the JSON data format. ## Benefits From 24df7c6fca226e5ccfbe39343b7d330105e75105 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Mon, 14 Nov 2022 11:41:33 +0000 Subject: [PATCH 158/206] Fix primer layout (#489) * Fix primer layout --- index.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.md b/index.md index 44c03f0c..6d2a709c 100644 --- a/index.md +++ b/index.md @@ -4,8 +4,11 @@ title: JSON Schema permalink: / --- +
        +**JSON Schema** is a declarative language that allows you to **annotate** and **validate** JSON documents. -**JSON Schema** is a declarative language that allows you to **annotate** and **validate** JSON documents. JSON Schema enables the confident and reliable use of the JSON data format. +JSON Schema enables the confident and reliable use of the JSON data format. +
        ## Benefits From d5a750e327d67e5757f10bd21b71f7290e568b29 Mon Sep 17 00:00:00 2001 From: Thomas Collins Date: Tue, 17 Jan 2023 22:25:58 +0000 Subject: [PATCH 159/206] Adding json-schema-static-docs to documentation generators Adding [json-schema-static-docs](https://tomcollins.github.io/json-schema-static-docs/) to the documentation generators section of the implementations page. --- implementations.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/implementations.md b/implementations.md index 6aa68b33..701f398d 100644 --- a/implementations.md +++ b/implementations.md @@ -319,6 +319,8 @@ the utility, and decided on a case-by-case basis. #### Documentation generators + +- [json-schema-static-docs]([https://github.com/yanick/jsonschematic/](https://tomcollins.github.io/json-schema-static-docs/)) - Generates human friendly markdown documentation from JSON Schema. Includes links between pages based on $ref values. Supports draft-7. - [jsonschematic](https://github.com/yanick/jsonschematic/) - Svelte-based schema viewer. Runs as a local web app. Supports draft-7. - [docson](https://github.com/lbovet/docson) - Javascript-based schema viewer. Runs as a local web app. Supports draft-4. - [json-schema-for-humans](https://pypi.org/project/json-schema-for-humans/) - Generate HTML representation of a schema. Python-based. Supports draft-7. From a40957c9abdda88a56a2f102083952acf257bd82 Mon Sep 17 00:00:00 2001 From: Thomas Collins Date: Wed, 18 Jan 2023 08:55:23 +0000 Subject: [PATCH 160/206] Correcting URL for json-schema-static-docs --- implementations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implementations.md b/implementations.md index 701f398d..b253e5a0 100644 --- a/implementations.md +++ b/implementations.md @@ -320,7 +320,7 @@ the utility, and decided on a case-by-case basis. #### Documentation generators -- [json-schema-static-docs]([https://github.com/yanick/jsonschematic/](https://tomcollins.github.io/json-schema-static-docs/)) - Generates human friendly markdown documentation from JSON Schema. Includes links between pages based on $ref values. Supports draft-7. +- [json-schema-static-docs](https://tomcollins.github.io/json-schema-static-docs/) - Generates human friendly markdown documentation from JSON Schema. Includes links between pages based on $ref values. Supports draft-7. - [jsonschematic](https://github.com/yanick/jsonschematic/) - Svelte-based schema viewer. Runs as a local web app. Supports draft-7. - [docson](https://github.com/lbovet/docson) - Javascript-based schema viewer. Runs as a local web app. Supports draft-4. - [json-schema-for-humans](https://pypi.org/project/json-schema-for-humans/) - Generate HTML representation of a schema. Python-based. Supports draft-7. From ed8505e7b2b621f57eddee070d446267f1dc9d58 Mon Sep 17 00:00:00 2001 From: Clemens Uhlenhut Date: Mon, 6 Feb 2023 08:54:38 +0100 Subject: [PATCH 161/206] Update implementations.md Added information about the latest release of JSONBuddy and support of draft 2020-12. --- implementations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implementations.md b/implementations.md index b253e5a0..88107db8 100644 --- a/implementations.md +++ b/implementations.md @@ -307,7 +307,7 @@ the utility, and decided on a case-by-case basis. - [Altova XMLSpy 2019r3](https://www.altova.com/xmlspy-xml-editor#json_schema) - *Graphical JSON Schema editor for draft-06 and draft-7, as well as validation of JSON files based on JSON Schema* - [Dashjoin JSON Schema editor](https://dashjoin.github.io/#/schema) - *Graphical online JSON Schema editor for draft-06 (minus oneOf, anyOf, allOf, not). The generated schema can be tested immediately via a form that is driven by it.* - [Hackolade Studio](https://hackolade.com/help/JSONSchemaEditor.html) - *Visual JSON Schema editor for draft-04, draft-06, draft-07, 2019-09, 2020-12, as well as data modeling tool for NoSQL databases, storage formats, REST APIs, and JSON in RDBMS. Also converts to and from: different draft specifications, DDL, XSD, Swagger, OpenAPI, YAML, Avro, Parquet, Protobuf, and most of the NoSQL script syntaxes. Includes a GUI for Entity-Relationship Diagrams and a Command-Line Interface.* -- [JSONBuddy](https://www.json-buddy.com/) - *Text and grid-style JSON editor and validator with JSON schema analyzer, context sensitive entry-helpers and sample data generation based on JSON schema. Support for draft-4, draft-6, draft-7 and 2019-09. JSON Schema validation debugger: Step through the validation process and set breakpoints.* +- [JSONBuddy](https://www.json-buddy.com/) - *Text and grid-style JSON editor and validator. Complete JSON Schema development environment with JSON Schema analyzer, context sensitive entry-helpers, sample data generation based on JSON Schema and JSON Schema validation debugger: Step through the validation process and set breakpoints. Support for draft-4, draft-6, draft-7, 2019-09 and 2020-12.* - [JSONEditor Online](https://jsoneditoronline.org/) - *View, edit, format, and validate JSON online* Support draft-4, draft-6, and draft-7. - [Liquid JSON Schema Editor](https://www.liquid-technologies.com/json-schema-editor) - *Graphical JSON Schema editor for draft-04, draft-06, draft-07 and 2019-09, with split source code and grphical editing. Includes validation of JSON files based on JSON Schema, JSON Sample Generator and JSON Schema Documentation Generator.* - [Oxygen JSON Schema Editor](https://www.oxygenxml.com/xml_developer/json_schema_editor.html) - *JSON Schema editor with a variety of editing features and helper views (Design/Text/Author). Support for validation and editing JSON Schema draft-4, draft-6, and draft-7, 2019-09 (partial), 2020-12 (partial). Validation and editing of JSON files based on JSON Schema.* From 500a0be86c0e258e2f982a79328cac5193effc80 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Tue, 21 Feb 2023 12:42:00 -0800 Subject: [PATCH 162/206] Don't serve docker files --- _config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/_config.yml b/_config.yml index 3a16502f..8540af95 100644 --- a/_config.yml +++ b/_config.yml @@ -36,6 +36,7 @@ exclude: - Gemfile - node_modules - vendor +- docker-compose.yml plugins: - jekyll-relative-links From db80fab9c7240929dd57336f7654ec9eb5d5003e Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Tue, 21 Feb 2023 13:13:54 -0800 Subject: [PATCH 163/206] Fix Netlify build --- .ruby-version | 1 + Gemfile | 1 + Gemfile.lock | 80 +++++++++++++++++++++++++-------------------------- _config.yml | 1 + 4 files changed, 42 insertions(+), 41 deletions(-) create mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..94ff29cc --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.1.1 diff --git a/Gemfile b/Gemfile index d74d7c0d..a3a27a46 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,4 @@ source 'https://rubygems.org' +ruby '3.1.1' gem 'github-pages', group: :jekyll_plugins gem 'webrick', '~> 1.7' diff --git a/Gemfile.lock b/Gemfile.lock index 4cf839f2..9111ff7b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,43 +1,42 @@ GEM remote: https://rubygems.org/ specs: - activesupport (6.0.5) + activesupport (7.0.4.2) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.11.1) colorator (1.1.0) - commonmarker (0.23.6) - concurrent-ruby (1.1.10) + commonmarker (0.23.8) + concurrent-ruby (1.2.0) dnsruby (1.61.9) simpleidn (~> 0.1) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) - ethon (0.15.0) + ethon (0.16.0) ffi (>= 1.15.0) eventmachine (1.2.7) execjs (2.8.1) - faraday (2.3.0) - faraday-net_http (~> 2.0) + faraday (2.7.4) + faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) - faraday-net_http (2.0.3) + faraday-net_http (3.0.2) ffi (1.15.5) forwardable-extended (2.6.0) gemoji (3.0.1) - github-pages (226) + github-pages (228) github-pages-health-check (= 1.17.9) - jekyll (= 3.9.2) + jekyll (= 3.9.3) jekyll-avatar (= 0.7.0) jekyll-coffeescript (= 1.1.1) - jekyll-commonmark-ghpages (= 0.2.0) + jekyll-commonmark-ghpages (= 0.4.0) jekyll-default-layout (= 0.1.4) jekyll-feed (= 0.15.1) jekyll-gist (= 1.5.0) @@ -71,10 +70,10 @@ GEM jemoji (= 0.12.0) kramdown (= 2.3.2) kramdown-parser-gfm (= 1.1.0) - liquid (= 4.0.3) + liquid (= 4.0.4) mercenary (~> 0.3) minima (= 2.5.1) - nokogiri (>= 1.13.4, < 2.0) + nokogiri (>= 1.13.6, < 2.0) rouge (= 3.26.0) terminal-table (~> 1.4) github-pages-health-check (1.17.9) @@ -83,17 +82,17 @@ GEM octokit (~> 4.0) public_suffix (>= 3.0, < 5.0) typhoeus (~> 1.3) - html-pipeline (2.14.2) + html-pipeline (2.14.3) activesupport (>= 2) nokogiri (>= 1.4) http_parser.rb (0.8.0) - i18n (0.9.5) + i18n (1.12.0) concurrent-ruby (~> 1.0) - jekyll (3.9.2) + jekyll (3.9.3) addressable (~> 2.4) colorator (~> 1.0) em-websocket (~> 0.5) - i18n (~> 0.7) + i18n (>= 0.7, < 2) jekyll-sass-converter (~> 1.0) jekyll-watch (~> 2.0) kramdown (>= 1.17, < 3) @@ -109,11 +108,11 @@ GEM coffee-script-source (~> 1.11.1) jekyll-commonmark (1.4.0) commonmarker (~> 0.22) - jekyll-commonmark-ghpages (0.2.0) - commonmarker (~> 0.23.4) + jekyll-commonmark-ghpages (0.4.0) + commonmarker (~> 0.23.7) jekyll (~> 3.9.0) jekyll-commonmark (~> 1.4.0) - rouge (>= 2.0, < 4.0) + rouge (>= 2.0, < 5.0) jekyll-default-layout (0.1.4) jekyll (~> 3.0) jekyll-feed (0.15.1) @@ -201,28 +200,26 @@ GEM rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - liquid (4.0.3) - listen (3.7.1) + liquid (4.0.4) + listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.3.6) - mini_portile2 (2.8.0) minima (2.5.1) jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) - minitest (5.16.1) - nokogiri (1.13.9) - mini_portile2 (~> 2.8.0) + minitest (5.17.0) + nokogiri (1.14.2-x86_64-linux) racc (~> 1.4) - octokit (4.25.0) + octokit (4.25.1) faraday (>= 1, < 3) sawyer (~> 0.9) pathutil (0.16.2) forwardable-extended (~> 2.6) public_suffix (4.0.7) - racc (1.6.0) - rb-fsevent (0.11.1) + racc (1.6.2) + rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) rexml (3.2.5) @@ -242,24 +239,25 @@ GEM unf (~> 0.1.4) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) - thread_safe (0.3.6) typhoeus (1.4.0) ethon (>= 0.9.0) - tzinfo (1.2.10) - thread_safe (~> 0.1) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) unf (0.1.4) unf_ext unf_ext (0.0.8.2) unicode-display_width (1.8.0) - webrick (1.7.0) - zeitwerk (2.6.0) + webrick (1.8.1) PLATFORMS - ruby + x86_64-linux-musl DEPENDENCIES github-pages webrick (~> 1.7) +RUBY VERSION + ruby 3.1.1p18 + BUNDLED WITH - 2.2.7 + 2.3.25 diff --git a/_config.yml b/_config.yml index 8540af95..3fd3064f 100644 --- a/_config.yml +++ b/_config.yml @@ -36,6 +36,7 @@ exclude: - Gemfile - node_modules - vendor +- cache - docker-compose.yml plugins: From 1577d2b2a30a41f7bdda28f90dbf82cb786747a6 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Tue, 21 Feb 2023 10:53:34 -0800 Subject: [PATCH 164/206] Expose 2020-12 hyper-schema vocabulary --- draft/2020-12/meta/hyper-schema | 1 + 1 file changed, 1 insertion(+) create mode 120000 draft/2020-12/meta/hyper-schema diff --git a/draft/2020-12/meta/hyper-schema b/draft/2020-12/meta/hyper-schema new file mode 120000 index 00000000..29e3d6ac --- /dev/null +++ b/draft/2020-12/meta/hyper-schema @@ -0,0 +1 @@ +../../../_includes/draft/2020-12/meta/hyper-schema.json \ No newline at end of file From 5f4340aa4ba4c6d7f46c9e69c86594b9e923f471 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Tue, 21 Feb 2023 13:44:07 -0800 Subject: [PATCH 165/206] Pull updated draft-07 hyper-schema-outout schema --- _includes/draft-07 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/draft-07 b/_includes/draft-07 index 6e2b4251..567f7685 160000 --- a/_includes/draft-07 +++ b/_includes/draft-07 @@ -1 +1 @@ -Subproject commit 6e2b42516dc7e8845c980d284c61bd44c9f95cd2 +Subproject commit 567f768506aaa33a38e552c85bf0586029ef1b32 From 6cff5deaebc773b2a34a6c4bb47591dfde0636b1 Mon Sep 17 00:00:00 2001 From: Jacques Yakoub Date: Wed, 22 Feb 2023 11:50:52 +0100 Subject: [PATCH 166/206] docs: add a extra "Documentation generator" --- implementations.md | 1 + 1 file changed, 1 insertion(+) diff --git a/implementations.md b/implementations.md index 88107db8..e0cc8bce 100644 --- a/implementations.md +++ b/implementations.md @@ -320,6 +320,7 @@ the utility, and decided on a case-by-case basis. #### Documentation generators +- [docusaurus-json-schema-plugin](https://github.com/jy95/docusaurus-json-schema-plugin) - Schema viewer. Runs within a [Docusaurus](https://docusaurus.io/) web app. Supports draft-7, 2019-09, Draft 2020-12 - [json-schema-static-docs](https://tomcollins.github.io/json-schema-static-docs/) - Generates human friendly markdown documentation from JSON Schema. Includes links between pages based on $ref values. Supports draft-7. - [jsonschematic](https://github.com/yanick/jsonschematic/) - Svelte-based schema viewer. Runs as a local web app. Supports draft-7. - [docson](https://github.com/lbovet/docson) - Javascript-based schema viewer. Runs as a local web app. Supports draft-4. From b05b08d31bda2673d202b7967346b992a528e207 Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Tekuri Date: Fri, 24 Feb 2023 18:16:42 +0530 Subject: [PATCH 167/206] Add boon validation library for Rust --- _data/validator-libraries-modern.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index a5229060..f1f126fa 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -321,6 +321,12 @@ last-updated: "2022-08-31" - name: Rust implementations: + - name: boon + url: https://github.com/santhosh-tekuri/boon + date-draft: [2020-12, 2019-09] + draft: [7, 6, 4] + license: Apache License 2.0 + last-updated: "2023-02-22" - name: jsonschema-rs url: https://github.com/Stranger6667/jsonschema-rs notes: Fast due to compiling schema into a validation tree; 2019-09 and 2020-12 are partially supported From d7a714909faace2ffe3c54e8a7c1a0b3cd3f8432 Mon Sep 17 00:00:00 2001 From: Benjamin Granados <40007659+benjagm@users.noreply.github.com> Date: Wed, 1 Feb 2023 18:04:08 +0100 Subject: [PATCH 168/206] Update validator-libraries-modern.yml Added a GitHub Action in a new category. --- _data/validator-libraries-modern.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index f1f126fa..9bf2dac3 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -453,3 +453,13 @@ last-updated: "2022-08-31" built-on: name: ajv +- name: Github Actions + implementations: + - name: Validate JSON Action + license: MIT + url: 'https://github.com/OrRosenblatt/validate-json-action' + date-draft: [2019-09, 2020-12] + draft: [] + built-on: + name: ajv + last-updated: "2023-02-01" From ec08a95bc8327fa53bd60cc041bd9988b61b9003 Mon Sep 17 00:00:00 2001 From: Matthew Adams Date: Tue, 14 Feb 2023 10:32:37 +0000 Subject: [PATCH 169/206] Added implementation details. --- _data/validator-libraries-modern.yml | 6 ++++++ implementations.md | 2 ++ 2 files changed, 8 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 9bf2dac3..84030d69 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -14,6 +14,12 @@ draft: [7, 6, 4, 3] license: "AGPL-3.0-only" last-updated: "2022-08-31" + - name: Corvus.JsonSchema + url: https://github.com/corvus-dotnet/corvus.jsonschema + date-draft: [2020-12, 2019-09] + draft: [7, 6] + license: Apache License, Version 2.0 + last-updated: "2023-02-14" - name: C notes: No known implementations support draft-06 or later. - name: C++ diff --git a/implementations.md b/implementations.md index e0cc8bce..37bef9a9 100644 --- a/implementations.md +++ b/implementations.md @@ -194,6 +194,8 @@ are the only keywords that changed. #### Code generation +- Dotnet + - [Corvus.JsonSchema](https://www.nuget.org/packages/Corvus.Json.JsonSchema.TypeGeneratorTool/) - generates an idiomatic dotnet type model from JSON Schema files, supporting all JSON Schema features, including property accessors, enumeration, common string `format`, and JSON document building/modification; over low-level `System.Text.Json` types. *supports Draft 6, Draft 7, Draft 2019-09 and Draft 2020-12*. - Elm - [json-schema-to-elm](https://github.com/dragonwasrobot/json-schema-to-elm) - generates Elm types, JSON decoders+encoders, and fuzz tests from one or more JSON Schema files, using [dragonwasrobot/json_schema](https://github.com/dragonwasrobot/json_schema) *supports Draft 7* - Go From 20f6094a35789aca785367882f165219062584c8 Mon Sep 17 00:00:00 2001 From: Benjamin Granados <40007659+benjagm@users.noreply.github.com> Date: Wed, 1 Feb 2023 17:44:14 +0100 Subject: [PATCH 170/206] Update implementations.md --- implementations.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/implementations.md b/implementations.md index 37bef9a9..3a210100 100644 --- a/implementations.md +++ b/implementations.md @@ -162,6 +162,8 @@ For example, the only incompatibilities between draft-04 and draft-06 involve `e - [scala-jsonschema](https://github.com/andyglow/scala-jsonschema) (Apache 2.0) - generates schemad out of Scala case classes - Ruby - [Shale](https://github.com/kgiszczak/shale) (MIT) - generates schema from Ruby models *supports Draft 2020-12* +- Rust + - [Schemars](https://github.com/GREsau/schemars) (MIT) - generates schema from Rust code *supports Draft 7* #### From data From f627c7f0a189f03ef9b0d0a48cd7087eb98ef36a Mon Sep 17 00:00:00 2001 From: Benjamin Granados <40007659+benjagm@users.noreply.github.com> Date: Wed, 1 Feb 2023 17:50:30 +0100 Subject: [PATCH 171/206] Update implementations.md Added OpenAPI2JSON schema converter --- implementations.md | 1 + 1 file changed, 1 insertion(+) diff --git a/implementations.md b/implementations.md index 3a210100..22de12f0 100644 --- a/implementations.md +++ b/implementations.md @@ -290,6 +290,7 @@ the utility, and decided on a case-by-case basis. - OpenAPI - [JSON Schema to OpenAPI Schema](https://github.com/wework/json-schema-to-openapi-schema) _draft-04_ Draft-06 and -07 planned per README (MIT) + - [OpenAPI specification to JSON Schema](https://github.com/instrumenta/openapi2jsonschema) Draft-07 (MIT) - Orderly - [Orderly](https://github.com/lloyd/orderly) (BSD-3-Clause) - RAML From 4b70748708c463a0169f3c91ef067d3652c0d7e4 Mon Sep 17 00:00:00 2001 From: Nicolas Le Cam Date: Tue, 28 Feb 2023 11:07:53 +0100 Subject: [PATCH 172/206] Update @cfworker/json-schema info --- _data/validator-libraries-modern.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 84030d69..4b76ded6 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -194,10 +194,10 @@ anchor-name: cfworker url: https://github.com/cfworker/cfworker/blob/master/packages/json-schema/README.md notes: "Built for Cloudflare workers, browsers, and Node.js" - date-draft: [2019-09] - draft: [7, 6, 4] + date-draft: [2019-09, 2020-12] + draft: [7, 4] license: MIT - last-updated: "2022-08-31" + last-updated: "2023-02-28" - name: JSON Schema Library url: https://github.com/sagold/json-schema-library notes: "Built for Node.js and browsers. Customizable json-validator and json-schema utilities for traversal, data generation and validation" From cc0706ef3f7fcfbe9f66c09078ae1f63d62ca424 Mon Sep 17 00:00:00 2001 From: Benjamin Granados Date: Tue, 7 Mar 2023 10:45:43 +0100 Subject: [PATCH 173/206] Adding the OpenJS Foundation logo and copyright to JSON Schema site. As per OpenJS Foundation onboarding requirements we need to add the OpenJS Foundation logo and copyright to JSON Schema site. --- _includes/footer.html | 5 ++- assets/main.scss | 7 ++++ assets/openjs_foundation-logo.svg | 67 +++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 assets/openjs_foundation-logo.svg diff --git a/_includes/footer.html b/_includes/footer.html index 6f99d796..d3537f08 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -19,7 +19,10 @@ diff --git a/assets/main.scss b/assets/main.scss index 9e965232..23875e58 100644 --- a/assets/main.scss +++ b/assets/main.scss @@ -176,4 +176,11 @@ $content-width: 960px !default; .wrapper.buttons { margin-bottom: 10px; +} + +.custom-logo-link { + /* display: inline-block; */ + max-height: 40px; + padding-bottom: 0.7em; + /* width: auto; */ } \ No newline at end of file diff --git a/assets/openjs_foundation-logo.svg b/assets/openjs_foundation-logo.svg new file mode 100644 index 00000000..fa063e7c --- /dev/null +++ b/assets/openjs_foundation-logo.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 3b773016a739ff11662c92891bc6304ac0182993 Mon Sep 17 00:00:00 2001 From: Benjamin Granados Date: Tue, 7 Mar 2023 11:07:33 +0100 Subject: [PATCH 174/206] Adding the OpenJS Foundation trademarks content. Adding the OpenJS Foundation trademarks content. --- _includes/footer.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/_includes/footer.html b/_includes/footer.html index d3537f08..95b34378 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -21,11 +21,16 @@ - + From 4195b02d3243cd8ad47208ffea50a91fe58ac95a Mon Sep 17 00:00:00 2001 From: Benjamin Granados Date: Tue, 7 Mar 2023 18:45:07 +0100 Subject: [PATCH 175/206] Included @jviotti Reference docs https://www.learnjsonschema.com/ Included @jviotti Reference docs https://www.learnjsonschema.com/ --- learn/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/learn/index.md b/learn/index.md index 37c3a883..d9b9f3b4 100644 --- a/learn/index.md +++ b/learn/index.md @@ -12,4 +12,5 @@ title: Learn * [card.schema.json](./examples/card.schema.json) * [geographical-location.schema.json](./examples/geographical-location.schema.json) * [Understanding JSON Schema](/understanding-json-schema/) +* [JSON Schema reference focumentation](https://www.learnjsonschema.com/) * [JSON Schema Glossary](./glossary.md) which attempts to explain conversational terminology From 706d7fade01431b740ab7de07d6394cbe991ecfe Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Wed, 8 Mar 2023 10:47:10 +0000 Subject: [PATCH 176/206] Fix typo Co-authored-by: Jason Desrosiers --- learn/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learn/index.md b/learn/index.md index d9b9f3b4..f94aaff2 100644 --- a/learn/index.md +++ b/learn/index.md @@ -12,5 +12,5 @@ title: Learn * [card.schema.json](./examples/card.schema.json) * [geographical-location.schema.json](./examples/geographical-location.schema.json) * [Understanding JSON Schema](/understanding-json-schema/) -* [JSON Schema reference focumentation](https://www.learnjsonschema.com/) +* [JSON Schema reference documentation](https://www.learnjsonschema.com/) * [JSON Schema Glossary](./glossary.md) which attempts to explain conversational terminology From cb53c1dbcaa9fb25dc9cf010c23d7100a8e30ce9 Mon Sep 17 00:00:00 2001 From: Benjamin Granados Date: Fri, 10 Mar 2023 15:14:37 +0100 Subject: [PATCH 177/206] Removing any reference to years in the OpenJS section Removing any reference to years in the OpenJS section --- _includes/footer.html | 1 - 1 file changed, 1 deletion(-) diff --git a/_includes/footer.html b/_includes/footer.html index 95b34378..46fe6fac 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -21,7 +21,6 @@ From 6c84af2059680a65defce977a8b823d210d13fd5 Mon Sep 17 00:00:00 2001 From: Tobias Buschor Date: Thu, 23 Mar 2023 20:21:40 +0100 Subject: [PATCH 178/206] Update validator-libraries-modern.yml --- _data/validator-libraries-modern.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 4b76ded6..b384a1b5 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -218,6 +218,12 @@ draft: [6] license: MIT last-updated: "2022-08-31" + - name: schema.js + url: https://github.com/nuxodin/schema.js + date-draft: [2020-12] + draft: [] + license: MIT + last-updated: "2023-03-23" - name: Kotlin implementations: - name: Medeia-validator From cf211cfd1061f3624d677035ebfca9554f9e8981 Mon Sep 17 00:00:00 2001 From: Tobias Buschor Date: Tue, 28 Mar 2023 11:09:58 +0200 Subject: [PATCH 179/206] Rename the implementation schema.js to jema.js (#511) * Rename the implementation schema.js to jema.js I have decided to use a more unique name. --- _data/validator-libraries-modern.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index b384a1b5..1844bfaa 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -218,12 +218,12 @@ draft: [6] license: MIT last-updated: "2022-08-31" - - name: schema.js - url: https://github.com/nuxodin/schema.js + - name: jema.js + url: https://github.com/nuxodin/jema.js date-draft: [2020-12] draft: [] license: MIT - last-updated: "2023-03-23" + last-updated: "2023-03-28" - name: Kotlin implementations: - name: Medeia-validator From 1a696c37375b658a5187cf195d62968dac772f6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Kl=C3=ADmek?= Date: Tue, 28 Mar 2023 12:19:32 +0200 Subject: [PATCH 180/206] Add Dataspecer to implementations (#509) --- implementations.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/implementations.md b/implementations.md index 22de12f0..cb578e54 100644 --- a/implementations.md +++ b/implementations.md @@ -179,6 +179,10 @@ For example, the only incompatibilities between draft-04 and draft-06 involve `e - [Liquid Online Tools](https://www.liquid-technologies.com/online-json-to-schema-converter) - infer JSON Schema from sample JSON data - [quicktype.io](https://app.quicktype.io/#l=schema) - infer JSON Schema from samples, and generate TypeScript, C++, go, Java, C#, Swift, etc. types from JSON Schema +#### From model + +- [Dataspecer](https://dataspecer.com) - Generates JSON Schema (and JSON-LD context) from conceptual model *supports Draft 2020-12* + Generators from schemas ----------------------- From dbe7f658b6086e39cec91ff331c7cf39244ee425 Mon Sep 17 00:00:00 2001 From: Alexander Tikhonov Date: Tue, 11 Apr 2023 14:18:47 +0300 Subject: [PATCH 181/206] Add mashumaro to implementations (#514) --- implementations.md | 1 + 1 file changed, 1 insertion(+) diff --git a/implementations.md b/implementations.md index cb578e54..5810819a 100644 --- a/implementations.md +++ b/implementations.md @@ -156,6 +156,7 @@ For example, the only incompatibilities between draft-04 and draft-06 involve `e - Python - [Pydantic](https://pydantic-docs.helpmanual.io/) (MIT) - generates schemas from Python models based on Python 3.6+ type hints. - [msgspec](https://jcristharif.com/msgspec/) (BSD-3-Clause) - generates schemas from Python type annotations. + - [mashumaro](https://github.com/Fatal1ty/mashumaro) (Apache 2.0) - generates schemas from Python type annotations - Java - [jsonschema-generator](https://github.com/victools/jsonschema-generator) (Apache 2.0) - generates schemas from Java types *supports Draft 7 and Draft 2019-09* - Scala From a7ba6527cef06c605d6bae1fdd44057bf25de173 Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Tue, 11 Apr 2023 13:22:04 +0200 Subject: [PATCH 182/206] adds erosb/json-sKema (#515) --- _data/validator-libraries-modern.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 1844bfaa..ce5a3c4e 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -151,6 +151,12 @@ docs: https://github.com/networknt/json-schema-validator/blob/master/doc/config.md instructions: "set `handleNullableField` to `false`" last-updated: "2022-08-31" + - name: erosb/json-sKema + url: https://github.com/erosb/json-sKema + notes: Successor of the everit-org/json-schema library + date-draft: [2020-12] + license: MIT + last-updated: "2023-04-10" - name: Snow url: https://github.com/ssilverman/snowy-json notes: Uses Maven for the project and Gson under the hood. From 850c0c84c942d77a0ae957fe9dd4c583b05c3c86 Mon Sep 17 00:00:00 2001 From: Isaac Yonemoto Date: Tue, 4 Apr 2023 15:23:54 -0500 Subject: [PATCH 183/206] Update validator-libraries-modern.yml --- _data/validator-libraries-modern.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index ce5a3c4e..79f1b4ea 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -88,6 +88,12 @@ last-updated: "2022-08-31" - name: Elixir implementations: + - name: Exonerate + url: https://hexdocs.pm/exonerate/Exonerate.html + date-draft: [2020-12, 2019-09] + draft: [7, 6, 4] + license: MIT + last-updated: "2023-04-04" - name: JsonXema url: https://github.com/hrzndhrn/json_xema date-draft: [] From d7c7f15d7d71146c190ea58450f9690696e39421 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Mon, 17 Apr 2023 12:31:59 +0100 Subject: [PATCH 184/206] Update slack invite link Previous one expired, so new slack invite link! The link doesn't have an expiery date, but sometimes expires after some number of uses... number unknown or not documented by Slack as far as I can tell. --- slack.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slack.md b/slack.md index 18113d47..0f8bb1cf 100644 --- a/slack.md +++ b/slack.md @@ -1,3 +1,3 @@ --- -redirect_to: https://join.slack.com/t/json-schema/shared_invite/zt-15ylccbuu-3T2bRia8uzhE157TSW6nXg +redirect_to: https://join.slack.com/t/json-schema/shared_invite/zt-1tc77c02b-z~UiKXqpM2gHchClKbUoXw --- From 76fa30ec186a89665f91247a1d9596ca1d3129c1 Mon Sep 17 00:00:00 2001 From: Chaitanya Chandurkar Date: Thu, 13 Apr 2023 03:01:47 -0400 Subject: [PATCH 185/206] Add json-schema-to-case-class to implementations --- implementations.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/implementations.md b/implementations.md index 5810819a..e5979b87 100644 --- a/implementations.md +++ b/implementations.md @@ -223,6 +223,8 @@ are the only keywords that changed. - [statham](https://github.com/jacksmith15/statham-schema) (MIT) - generate type-annotated models from JSON Schema documents. - Rust - [schemafy](https://github.com/Marwes/schemafy/) - generates Rust types and serialization code from a JSON schema. *supports Draft 4* +- Scala + - [json-schema-to-case-class](https://github.com/cchandurkar/json-schema-to-case-class#readme) (MIT) - NPM Package, [Web UI](https://cchandurkar.github.io/json-schema-to-case-class) and a CLI to generate Scala case classes from JSON Schema. *Supports JSON Schema 2019-09, draft-07, -06, -04, -03* - TypeScript - [jsongenerator](https://github.com/jimblackler/jsonschematypes/tree/master/codegen) *JSON Schema 2019-09, draft-07, -06, -04, -03* (Apache-2.0) - Ruby From 2f96bcc762fce95430f6364df17196df3cbe9755 Mon Sep 17 00:00:00 2001 From: Chaitanya Chandurkar Date: Thu, 13 Apr 2023 03:05:21 -0400 Subject: [PATCH 186/206] Link to main repo --- implementations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implementations.md b/implementations.md index e5979b87..24cd8fff 100644 --- a/implementations.md +++ b/implementations.md @@ -224,7 +224,7 @@ are the only keywords that changed. - Rust - [schemafy](https://github.com/Marwes/schemafy/) - generates Rust types and serialization code from a JSON schema. *supports Draft 4* - Scala - - [json-schema-to-case-class](https://github.com/cchandurkar/json-schema-to-case-class#readme) (MIT) - NPM Package, [Web UI](https://cchandurkar.github.io/json-schema-to-case-class) and a CLI to generate Scala case classes from JSON Schema. *Supports JSON Schema 2019-09, draft-07, -06, -04, -03* + - [json-schema-to-case-class](https://github.com/cchandurkar/json-schema-to-case-class) (MIT) - NPM Package, [Web UI](https://cchandurkar.github.io/json-schema-to-case-class) and a CLI to generate Scala case classes from JSON Schema. *Supports JSON Schema 2019-09, draft-07, -06, -04, -03* - TypeScript - [jsongenerator](https://github.com/jimblackler/jsonschematypes/tree/master/codegen) *JSON Schema 2019-09, draft-07, -06, -04, -03* (Apache-2.0) - Ruby From 2f0a2f8b8304afcc263a242567dc04a2890a195e Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Wed, 26 Apr 2023 16:56:50 -0400 Subject: [PATCH 187/206] Slightly loosen the language defining dialects and vocabularies. Even though this isn't fully consistent with the current spec definitions, it matches colloquial uses, and perhaps plans for future changes to these two concepts, without sacrificing accuracy today. --- learn/glossary.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/learn/glossary.md b/learn/glossary.md index 1fd68007..325cd5a9 100644 --- a/learn/glossary.md +++ b/learn/glossary.md @@ -16,12 +16,15 @@ The entries on this page can be linked to via anchor links (e.g. `https://json-s ### dialect -A collection of [vocabularies](#vocabulary), along with an indication of whether supporting each vocabulary is required to process schemas written in the dialect. +A cohesive collection of [keywords](#keyword) available for use within a schema, often representing a use-case specific single release of the JSON Schema specification. -Dialects are identified by a URI, which [schemas](#schema) may then reference in their `$schema` [keyword](#keyword). +Dialects, particularly the 2019-09 and 2020-12 dialects, are often defined via a collection of [vocabularies](#vocabulary). + +Each dialect is identified by a URI, its *dialect identifier*, which [schemas](#schema) may then reference in their `$schema` [keyword](#keyword). Doing so identifies the schema as being written in the dialect, and thereby indicates which keywords are usable within it, along with their intended meaning. -The JSON Schema specification [defines](https://json-schema.org/specification.html#general-purpose-meta-schema) a number of dialects, each of which enable vocabularies suitable for the dialect's specific use case. +The JSON Schema specification defines a number of dialects, each of which enable vocabularies suitable for the dialect's specific use case. +These vocabularies are [described](https://json-schema.org/specification.html#general-purpose-meta-schema) in meta-schemas. ### draft @@ -82,7 +85,7 @@ In recent [drafts](#draft) of the specification, a schema is either a JSON objec ### vocabulary -A collection of related [keywords](keyword), grouped to facilitate re-use. +A tightly related collection of [keywords](keyword), grouped to facilitate re-use. A vocabulary is specified by a prose document or specification which explains the semantics of its keywords in a way suitable for implementers and users of the vocabulary. It often also includes a [meta-schema](#meta-schema) (or multiple metaschemas) which define the syntax of its keywords. @@ -90,7 +93,7 @@ It often also includes a [meta-schema](#meta-schema) (or multiple metaschemas) w Anyone can create and publish a vocabulary, and implementations generally will include facilities for extending themselves with support for additional vocabularies and their keywords. The JSON Schema specification includes a number of vocabularies which cover each of the keywords it defines. -Vocabularies are identified by a URI which may be referenced via the `$vocabulary` keyword in order to enable the vocabulary within a [dialect](#dialect). +In some [dialects](#dialect) of JSON Schema, the `$vocabulary` keyword can be used to include the keywords defined by a vocabulary into the dialect, as well as to indicate whether implementations must specifically recognize the vocabulary in order to be able to process schemas written in the dialect or not. #### See also From 7e4de361720ace9a4d2ac18fabc549dd7e9dac2b Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Thu, 27 Apr 2023 11:14:50 -0400 Subject: [PATCH 188/206] Add a glossary entry for subschema. --- learn/glossary.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/learn/glossary.md b/learn/glossary.md index 325cd5a9..15f8a9d6 100644 --- a/learn/glossary.md +++ b/learn/glossary.md @@ -83,6 +83,24 @@ Strictly speaking, according to the specification, schemas are themselves JSON d In recent [drafts](#draft) of the specification, a schema is either a JSON object or a JSON boolean value. +### subschema + +A [schema](#schema) which is itself contained within a surrounding parent schema. +Like schemas themselves, in recent [drafts](#draft) of JSON Schema, subschemas are either JSON objects or JSON boolean values. + +Within the JSON Schema specification and its [dialects](#dialect), a number of [keywords](#keyword) take subschemas as part of their values. +For example, the `not` keyword takes a subschema value and inverts its result, succeeding whenever the subschema does not succeed, such that the [instance](#instance) `12` is invalid under `{"type": "string"}` but valid under `{"not": {"type": "string"}}`, where `{"type": "string"}` is a subschema contained in the full schema. + +Some subschemas may appear in more complex nested locations within a parent schema. +The `allOf` keyword, for instance, takes an array of multiple subschemas and succeeds whenever all of the subschemas do individually. + +Whether something that otherwise *appears* to be a schema (based on its contents) actually *is* a subschema can be misleading at first glance without context or knowlege about its location within the parent schema. +Specifically, in our above example, `{"type": "string"}` was a subschema of a larger schema, but in the schema `{"const": {"type": "string"}}`, it is *not* a subschema. +Even though as a value it looks the same, the `const` keyword, which compares instances against a specific expected value, does *not* take a subschema as its value, its value is an opaque value with no particular meaning (such that in this schema, the number 12 would be invalid, but the precise instance `{"type": "string"}` is valid). +Said more plainly, whether a particular value is a subschema or not depends on its precise location within a parent schema, as interpretation of the value depends on the defined behavior of the keyword(s) it lives under. + +Subschemas may themselves contain sub-subschemas, though colloquially one generally uses the term "subschema" regardless of the level of nesting, further clarifying which larger schema is the parent schema whenever needed. + ### vocabulary A tightly related collection of [keywords](keyword), grouped to facilitate re-use. From 21276dc13d350817cc6584a9f497647f006ebc83 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Tue, 2 May 2023 13:47:45 -0400 Subject: [PATCH 189/206] Add a glossary entry for JSON. --- learn/glossary.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/learn/glossary.md b/learn/glossary.md index 15f8a9d6..08a9681a 100644 --- a/learn/glossary.md +++ b/learn/glossary.md @@ -36,6 +36,18 @@ While future drafts may introduce new behavior or changes to existing behavior, The current list of drafts can be found [here](https://json-schema.org/specification-links.html#published-drafts). +### JSON + +A pervasive data interchange format used for representing and transmitting data as human readable text. +JSON is extremely widely used, and parsers which can read and write it exist for essentially every commonly-used programming language. + +JSON Schema, distinctly, is built *on top* of JSON, in that JSON [schemas](#schema) are themselves JSON objects which describe other JSON objects. +The two are, however, entirely different pieces of the conceptual puzzle, with JSON being a concrete format for *representing* data and JSON Schema being a way to *schematize* data which is written in the JSON format. + +The JSON format is an open format, with its own [homepage](https://www.json.org/), and specifications published in the [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf) and [RFC-8259](https://datatracker.ietf.org/doc/html/rfc8259) documents from ECMA and the IETF respectively. +In particular, it is not managed or developed by the JSON Schema team, who simply make use of the format. + + ### keyword A property appearing within a [schema](#schema) object. @@ -79,14 +91,14 @@ A document, written according to the proscribed structure of the JSON Schema spe The rules constituting which schemas are conformant, as well as the rules governing their behavior when validating instances, are defined by the [JSON Schema specification](https://json-schema.org/specification.html). -Strictly speaking, according to the specification, schemas are themselves JSON documents, though it is somewhat common for them to be authored or maintained in other languages which are easily translated to JSON, such as YAML. +Strictly speaking, according to the specification, schemas are themselves [JSON documents](#JSON), though it is somewhat common for them to be authored or maintained in other languages which are easily translated to JSON, such as YAML. In recent [drafts](#draft) of the specification, a schema is either a JSON object or a JSON boolean value. ### subschema A [schema](#schema) which is itself contained within a surrounding parent schema. -Like schemas themselves, in recent [drafts](#draft) of JSON Schema, subschemas are either JSON objects or JSON boolean values. +Like schemas themselves, in recent [drafts](#draft) of JSON Schema, subschemas are either [JSON](#JSON) objects or JSON boolean values. Within the JSON Schema specification and its [dialects](#dialect), a number of [keywords](#keyword) take subschemas as part of their values. For example, the `not` keyword takes a subschema value and inverts its result, succeeding whenever the subschema does not succeed, such that the [instance](#instance) `12` is invalid under `{"type": "string"}` but valid under `{"not": {"type": "string"}}`, where `{"type": "string"}` is a subschema contained in the full schema. From c0b1495a94c2834ee7f0e2a9aa5d3b173c7ad57f Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Thu, 4 May 2023 10:31:58 -0400 Subject: [PATCH 190/206] Apply suggestions from CR Co-authored-by: Jason Desrosiers --- learn/glossary.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/learn/glossary.md b/learn/glossary.md index 08a9681a..8328a958 100644 --- a/learn/glossary.md +++ b/learn/glossary.md @@ -41,8 +41,8 @@ The current list of drafts can be found [here](https://json-schema.org/specifica A pervasive data interchange format used for representing and transmitting data as human readable text. JSON is extremely widely used, and parsers which can read and write it exist for essentially every commonly-used programming language. -JSON Schema, distinctly, is built *on top* of JSON, in that JSON [schemas](#schema) are themselves JSON objects which describe other JSON objects. -The two are, however, entirely different pieces of the conceptual puzzle, with JSON being a concrete format for *representing* data and JSON Schema being a way to *schematize* data which is written in the JSON format. +JSON Schema, distinctly, is built *on top* of JSON, in that JSON [schemas](#schema) are themselves JSON objects which describe JSON values. +The two are, however, entirely different pieces of the conceptual puzzle, with JSON being a concrete format for *representing* data, and JSON Schema being a way to *schematize* data which is written in a JSON-compatible format. The JSON format is an open format, with its own [homepage](https://www.json.org/), and specifications published in the [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf) and [RFC-8259](https://datatracker.ietf.org/doc/html/rfc8259) documents from ECMA and the IETF respectively. In particular, it is not managed or developed by the JSON Schema team, who simply make use of the format. From 805bec0239cc5c7153e1d3dba83e7506dadf559f Mon Sep 17 00:00:00 2001 From: slisaasquatch Date: Mon, 24 Apr 2023 11:41:46 -0700 Subject: [PATCH 191/206] Update saasquatch/json-schema-inferrer --- implementations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implementations.md b/implementations.md index 24cd8fff..f5054ae1 100644 --- a/implementations.md +++ b/implementations.md @@ -169,7 +169,7 @@ For example, the only incompatibilities between draft-04 and draft-06 involve `e #### From data - Java - - [saasquatch/json-schema-inferrer](https://github.com/saasquatch/json-schema-inferrer) _draft-07, -06, -04_ (Apache 2.0) - Java library for inferring JSON Schemas from one or multiple JSON samples. + - [saasquatch/json-schema-inferrer](https://github.com/saasquatch/json-schema-inferrer) _2020-12, 2019-09, draft-07, draft-06, draft-04_ (Apache 2.0) - Java library for inferring JSON Schemas from one or multiple JSON samples. - Scala - [Schema Guru](https://github.com/snowplow/schema-guru) (Apache 2.0) - CLI util, Spark Job and Web UI for deriving JSON Schemas out of corpus of JSON instances; see issue [178](https://github.com/snowplow/schema-guru/issues/178) for progress towards draft-06+ support - [JSONoid](https://github.com/michaelmior/jsonoid-discovery/) (MIT) - command line tool and Spark application for inferring schemas from JSON documents, supports draft 2019-09 From 6901d61c0ff8db1568e4db1da4be4417e340e5c3 Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Sun, 18 Jun 2023 17:18:19 -0700 Subject: [PATCH 192/206] Remove 2019-09,2020-12 support from networknt --- _data/validator-libraries-modern.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 79f1b4ea..7327709a 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -149,7 +149,7 @@ - name: networknt/json-schema-validator url: https://github.com/networknt/json-schema-validator notes: Support OpenAPI 3.0 with Jackson parser - date-draft: [2020-12, 2019-09] + date-draft: [] draft: [7, 6, 4] license: Apache License 2.0 compliance: From 65556f7a16c9a888898ebb37a62bf19280d6f2a2 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Tue, 11 Jul 2023 11:46:13 +0100 Subject: [PATCH 193/206] Update slack link Fixes https://github.com/json-schema-org/blog/issues/34 Should not expire. Is limited to 400 uses per slack requirements. --- slack.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slack.md b/slack.md index 0f8bb1cf..cc97f5ed 100644 --- a/slack.md +++ b/slack.md @@ -1,3 +1,3 @@ --- -redirect_to: https://join.slack.com/t/json-schema/shared_invite/zt-1tc77c02b-z~UiKXqpM2gHchClKbUoXw +redirect_to: https://join.slack.com/t/json-schema/shared_invite/zt-1ywpdj4yd-bXiBLjYEbKWUjzon0qiY9Q --- From a086d976948e5bc6aee326dd892ddcaa58be313c Mon Sep 17 00:00:00 2001 From: Clemens Uhlenhut Date: Fri, 30 Jun 2023 12:55:17 +0200 Subject: [PATCH 194/206] Update implementations.md Added information about JSON Schema testing tool. --- implementations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implementations.md b/implementations.md index f5054ae1..66d5ad7c 100644 --- a/implementations.md +++ b/implementations.md @@ -319,7 +319,7 @@ the utility, and decided on a case-by-case basis. - [Altova XMLSpy 2019r3](https://www.altova.com/xmlspy-xml-editor#json_schema) - *Graphical JSON Schema editor for draft-06 and draft-7, as well as validation of JSON files based on JSON Schema* - [Dashjoin JSON Schema editor](https://dashjoin.github.io/#/schema) - *Graphical online JSON Schema editor for draft-06 (minus oneOf, anyOf, allOf, not). The generated schema can be tested immediately via a form that is driven by it.* - [Hackolade Studio](https://hackolade.com/help/JSONSchemaEditor.html) - *Visual JSON Schema editor for draft-04, draft-06, draft-07, 2019-09, 2020-12, as well as data modeling tool for NoSQL databases, storage formats, REST APIs, and JSON in RDBMS. Also converts to and from: different draft specifications, DDL, XSD, Swagger, OpenAPI, YAML, Avro, Parquet, Protobuf, and most of the NoSQL script syntaxes. Includes a GUI for Entity-Relationship Diagrams and a Command-Line Interface.* -- [JSONBuddy](https://www.json-buddy.com/) - *Text and grid-style JSON editor and validator. Complete JSON Schema development environment with JSON Schema analyzer, context sensitive entry-helpers, sample data generation based on JSON Schema and JSON Schema validation debugger: Step through the validation process and set breakpoints. Support for draft-4, draft-6, draft-7, 2019-09 and 2020-12.* +- [JSONBuddy](https://www.json-buddy.com/) - *Text and grid-style JSON editor and validator. Complete JSON Schema development environment with JSON Schema analyzer, context sensitive entry-helpers, sample data generation based on JSON Schema and JSON Schema validation debugger: Step through the validation process and set breakpoints. JSON Schema testing tool including schema coverage. Support for draft-4, draft-6, draft-7, 2019-09 and 2020-12.* - [JSONEditor Online](https://jsoneditoronline.org/) - *View, edit, format, and validate JSON online* Support draft-4, draft-6, and draft-7. - [Liquid JSON Schema Editor](https://www.liquid-technologies.com/json-schema-editor) - *Graphical JSON Schema editor for draft-04, draft-06, draft-07 and 2019-09, with split source code and grphical editing. Includes validation of JSON files based on JSON Schema, JSON Sample Generator and JSON Schema Documentation Generator.* - [Oxygen JSON Schema Editor](https://www.oxygenxml.com/xml_developer/json_schema_editor.html) - *JSON Schema editor with a variety of editing features and helper views (Design/Text/Author). Support for validation and editing JSON Schema draft-4, draft-6, and draft-7, 2019-09 (partial), 2020-12 (partial). Validation and editing of JSON files based on JSON Schema.* From fb3b1e681e273738f38cb1438b0635b6d4ad5383 Mon Sep 17 00:00:00 2001 From: Harrel Date: Thu, 29 Jun 2023 22:04:21 +0200 Subject: [PATCH 195/206] add dev.harrel:json-schema implementation --- _data/validator-libraries-modern.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 7327709a..45401832 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -182,6 +182,12 @@ draft: [7, 6, 4] license: Apache License 2.0 last-updated: "2022-08-31" + - name: json-schema (dev.harrel) + url: https://github.com/harrel56/json-schema + notes: JSON library agnostic implementation. Supports custom keywords. + date-draft: [ 2020-12 ] + license: MIT + last-updated: "2023-06-29" - name: JavaScript implementations: - name: Hyperjump JSV From afebf6b72b471f754a89a8ab19dbc6676b7adac2 Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Wed, 2 Aug 2023 11:55:01 +0400 Subject: [PATCH 196/206] Add new json-schema-validator library to the list of implementations --- _data/validator-libraries-modern.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 45401832..6abf666e 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -261,6 +261,15 @@ draft: [7] license: MIT last-updated: "2022-08-31" + - name: json-schema-validator + url: https://github.com/OptimumCode/json-schema-validator + notes: | + Kotlin Muliplatform implementation of JSON schema to validate the JsonElement from kotlinx.serialization-json. + The library is 'work in progress' and new features/drafts will be added in the future. + date-draft: [] + draft: [7] + license: MIT + last-updated: "2023-08-01" - name: Perl implementations: - name: JSON::Schema::Modern From 9ac36093083da18743d6b2d98faa94fb9974ef29 Mon Sep 17 00:00:00 2001 From: Nikita Skovoroda Date: Tue, 29 Aug 2023 20:24:03 +0300 Subject: [PATCH 197/206] Add `@exodus/schemasafe` validation library for JavaScript --- _data/validator-libraries-modern.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 6abf666e..40122198 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -197,6 +197,20 @@ draft: [7, 6, 4] license: MIT last-updated: "2022-08-31" + - name: "@exodus/schemasafe" + url: https://github.com/ExodusMovement/schemasafe + notes: | + For Node.js and browsers, with security and speed being the main focus. Pre-compiles schemas to JS functions. + [Supports OpenAPI `discriminator`](https://github.com/ExodusMovement/schemasafe/blob/master/doc/Discriminator-support.md). + Default behavior is hardened with additional schema coherence validation. + date-draft: [2020-12, 2019-09] + draft: [7, 6, 4] + license: MIT + compliance: + config: + docs: https://github.com/ExodusMovement/schemasafe/blob/master/doc/Options.md + instructions: "disable schema coherence checks and `format` assertion by setting option `mode: 'spec'`" + last-updated: "2023-08-29" - name: ajv url: https://github.com/ajv-validator/ajv notes: "for Node.js and browsers - supports [user-defined keywords](https://github.com/ajv-validator/ajv/blob/master/docs/keywords.md) and [$data reference](https://github.com/json-schema-org/json-schema-spec/issues/51)" From 24d63efaa905e96074ddb1c01676068639a282f0 Mon Sep 17 00:00:00 2001 From: Chrusty Date: Thu, 7 Sep 2023 09:51:09 +1200 Subject: [PATCH 198/206] Adding protoc-gen-jsonschema as a code-generator --- implementations.md | 1 + 1 file changed, 1 insertion(+) diff --git a/implementations.md b/implementations.md index 66d5ad7c..ddb15002 100644 --- a/implementations.md +++ b/implementations.md @@ -207,6 +207,7 @@ are the only keywords that changed. - [json-schema-to-elm](https://github.com/dragonwasrobot/json-schema-to-elm) - generates Elm types, JSON decoders+encoders, and fuzz tests from one or more JSON Schema files, using [dragonwasrobot/json_schema](https://github.com/dragonwasrobot/json_schema) *supports Draft 7* - Go - [go-jsonschema](https://git.sr.ht/~emersion/go-jsonschema) - generates Go types and helpers from JSON schema files *supports Draft 2020-12* + - [protoc-gen-jsonschema](https://github.com/chrusty/protoc-gen-jsonschema) - Generates JSON schemas from protobuf proto v2 and v3 files. - Java - [jsonCodeGen](https://github.com/schlothauer-wauer/jsoncodegen) (MIT) - Groovy based generation tasks from JSON schema. Already includes templates/generators for Java Beans, Swagger specification files and PlantUML diagrams. - [jsonschema2pojo](https://github.com/joelittlejohn/jsonschema2pojo) (Apache 2.0) - generates Java types from JSON Schema (or example JSON) and can annotate those types for data-binding with Jackson 2.x or Gson. *draft-07* From ed82c99e2b68fd92e1e205b50b323efe87e925db Mon Sep 17 00:00:00 2001 From: Sergei Maertens Date: Wed, 6 Sep 2023 14:16:27 +0200 Subject: [PATCH 199/206] Add drf-jsonschema-serializer schema generator --- implementations.md | 1 + 1 file changed, 1 insertion(+) diff --git a/implementations.md b/implementations.md index ddb15002..9c44bf9c 100644 --- a/implementations.md +++ b/implementations.md @@ -157,6 +157,7 @@ For example, the only incompatibilities between draft-04 and draft-06 involve `e - [Pydantic](https://pydantic-docs.helpmanual.io/) (MIT) - generates schemas from Python models based on Python 3.6+ type hints. - [msgspec](https://jcristharif.com/msgspec/) (BSD-3-Clause) - generates schemas from Python type annotations. - [mashumaro](https://github.com/Fatal1ty/mashumaro) (Apache 2.0) - generates schemas from Python type annotations + - [drf-jsonschema-serializer](https://github.com/maykinmedia/drf-jsonschema-serializer) (BSD-3-Clause) - generates schemas from Django Rest Framework serializers - Java - [jsonschema-generator](https://github.com/victools/jsonschema-generator) (Apache 2.0) - generates schemas from Java types *supports Draft 7 and Draft 2019-09* - Scala From cdbcf6919442b218fd6d957746028d6ae1c0c8b3 Mon Sep 17 00:00:00 2001 From: David Harsha Date: Sun, 20 Aug 2023 14:54:22 -0700 Subject: [PATCH 200/206] Add 2020-12/2019-09 support to json_schemer (ruby) Just released version 2.0.0 with support for these drafts: https://github.com/davishmcclurg/json_schemer/pull/135 --- _data/validator-libraries-modern.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 40122198..9b4b6e8e 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -362,10 +362,10 @@ implementations: - name: JSONSchemer url: https://github.com/davishmcclurg/json_schemer - date-draft: [] + date-draft: [2020-12, 2019-09] draft: [7, 6, 4] license: MIT - last-updated: "2022-08-31" + last-updated: "2023-08-20" - name: JSI url: https://rubydoc.info/gems/jsi date-draft: [] From a322db4c7a9ee4f101ed7f270ff5bc9bd2723e7a Mon Sep 17 00:00:00 2001 From: David Harsha Date: Sun, 20 Aug 2023 15:49:25 -0700 Subject: [PATCH 201/206] Improve implementation draft list layout This adds a comma between `draft` and `date-draft` items and checks for `empty` arrays to prevent stray "draft-0" output. --- implementations.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/implementations.md b/implementations.md index 9c44bf9c..c2df42b0 100644 --- a/implementations.md +++ b/implementations.md @@ -50,10 +50,11 @@ Validators {{ implementation.name }}
        • Supports: - {% if implementation.date-draft %} + {% if implementation.date-draft and implementation.date-draft != empty %} {{ implementation.date-draft | sort | reverse | join: ", " }} + {%- if implementation.draft and implementation.draft != empty %}, {% endif %} {% endif %} - {% if implementation.draft %} + {% if implementation.draft and implementation.draft != empty %} draft-0{{ implementation.draft | sort | reverse | join: ", -0" }} {% endif %}
        • From 619d105f900bd078578787d13a043874460e8382 Mon Sep 17 00:00:00 2001 From: Niklas Eldberger Date: Tue, 12 Sep 2023 16:09:06 +0200 Subject: [PATCH 202/206] Add Zuunr JSON, Java validator --- _data/validator-libraries-modern.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_data/validator-libraries-modern.yml b/_data/validator-libraries-modern.yml index 9b4b6e8e..04de6723 100644 --- a/_data/validator-libraries-modern.yml +++ b/_data/validator-libraries-modern.yml @@ -188,6 +188,12 @@ date-draft: [ 2020-12 ] license: MIT last-updated: "2023-06-29" + - name: Zuunr JSON + url: https://bitbucket.org/zuunr/json + notes: Immutable JSON representation in Java + validation and filtering based on JSON Schema + date-draft: [ 2020-12 ] + license: Apache 2.0 + last-updated: 2023-09-04 - name: JavaScript implementations: - name: Hyperjump JSV From 9e2873d81a3e13eb980e08889c0f31c5ee50dd4d Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Mon, 2 Oct 2023 10:22:14 +0100 Subject: [PATCH 203/206] Delete CNAME Website is now deployed via Cloudflare from new `website` repo for this org. --- CNAME | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 CNAME diff --git a/CNAME b/CNAME deleted file mode 100644 index 0d9c62bd..00000000 --- a/CNAME +++ /dev/null @@ -1,2 +0,0 @@ -json-schema.org - From 1ded71fde5e9773132c1e85c17d3e6e1c0086af7 Mon Sep 17 00:00:00 2001 From: Benjamin Granados <40007659+benjagm@users.noreply.github.com> Date: Wed, 11 Oct 2023 15:51:28 +0200 Subject: [PATCH 204/206] Add deprecation notice Add deprecation notice --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index b1992750..75764538 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,10 @@ +--- +📌 **Deprecation Notice** 📌 + +This repository is now deprecated. To contribute to JSON Schema's website please use the new repository ➡️ [https://github.com/json-schema-org/website](https://github.com/json-schema-org/website). + +--- + # JSON Schema Website [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://github.com/json-schema-org/.github/blob/main/CODE_OF_CONDUCT.md) From 15701ceb9ad63bdb72e24b826df74899796547ca Mon Sep 17 00:00:00 2001 From: Benjamin Granados <40007659+benjagm@users.noreply.github.com> Date: Mon, 23 Oct 2023 11:02:47 +0200 Subject: [PATCH 205/206] Update README.md to tidy up badges. Tidy up badges. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 75764538..96dcb5ef 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This repository is now deprecated. To contribute to JSON Schema's website please # JSON Schema Website [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://github.com/json-schema-org/.github/blob/main/CODE_OF_CONDUCT.md) -[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) +[![Project Status: Moved/Deprecated to https://github.com/json-schema-org/website – The project has been moved to a new location, and the version at that location should be considered authoritative.](https://www.repostatus.org/badges/latest/moved.svg)](https://www.repostatus.org/#moved) to [https://github.com/json-schema-org/website](https://github.com/json-schema-org/websitem) [![Financial Contributors on Open Collective](https://opencollective.com/json-schema/all/badge.svg?label=financial+contributors)](https://opencollective.com/json-schema) This is the repository for the [JSON Schema website](https://json-schema.org). From 91018fefd959caec966910184ef4a5ccb6aae326 Mon Sep 17 00:00:00 2001 From: Benjamin Granados <40007659+benjagm@users.noreply.github.com> Date: Tue, 24 Oct 2023 16:52:34 +0200 Subject: [PATCH 206/206] Update README.md to tidy up badges Update README.md to tidy up badges --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 96dcb5ef..5ee11859 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,9 @@ This repository is now deprecated. To contribute to JSON Schema's website please # JSON Schema Website -[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://github.com/json-schema-org/.github/blob/main/CODE_OF_CONDUCT.md) [![Project Status: Moved/Deprecated to https://github.com/json-schema-org/website – The project has been moved to a new location, and the version at that location should be considered authoritative.](https://www.repostatus.org/badges/latest/moved.svg)](https://www.repostatus.org/#moved) to [https://github.com/json-schema-org/website](https://github.com/json-schema-org/websitem) + +[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://github.com/json-schema-org/.github/blob/main/CODE_OF_CONDUCT.md) [![Financial Contributors on Open Collective](https://opencollective.com/json-schema/all/badge.svg?label=financial+contributors)](https://opencollective.com/json-schema) This is the repository for the [JSON Schema website](https://json-schema.org).