Skip to content

Commit

Permalink
feat(draft3): add support for draft3
Browse files Browse the repository at this point in the history
incorporate all feedback

fixes #268
  • Loading branch information
jeremyfiel committed Nov 7, 2024
1 parent c5d9d38 commit 07b6424
Show file tree
Hide file tree
Showing 32 changed files with 796 additions and 3 deletions.
18 changes: 18 additions & 0 deletions content/draft3/core/_index.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: "Draft 3"
description: "A JSON Media Type for Describing the Structure and Meaning of JSON Documents"
summary: "JSON Schema Draft 3 is a JSON media type that provides a contract for what JSON data is required for a given application and how to interact with it. JSON Schema is intended to define validation, documentation, hyperlink navigation, and interaction control of JSON data."
organization: JSON Schema
specification: "https://json-schema.org/draft-03/draft-zyp-json-schema-03"
index: -99
authors:
- github: kriszyp
first: Kris
last: Zyp
- github: garycourt
first: Gary
last: Court
metaschema: "http://json-schema.org/draft-03/schema#"
year: 2010
bowtie: "https://bowtie.report/#/dialects/draft3"
---
26 changes: 26 additions & 0 deletions content/draft3/core/additionalItems.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
keyword: "additionalItems"
signature: "Schema | Boolean"
value: This keyword must be set to a valid JSON Schema
summary: "If [`items`](/draft3/validation/items) is set to an array of schemas, validation succeeds if each element of the instance not covered by it validates against this schema. If set to a boolean, no additional items are allowed in the array instance."
kind: [ "applicator" ]
instance: [ "array" ]
specification: "https://json-schema.org/draft-03/draft-zyp-json-schema-03.pdf#5.6"
metaschema: "http://json-schema.org/draft-03/schema#"
default:
value: "{}"
tests:
- draft3/additionalItems.json
index: -98
introduced_in: draft3
interdependencies:
- vocabulary: core
keyword: items
- vocabulary: core
keyword: minItems
- vocabulary: core
keyword: maxItems
related:
- vocabulary: core
keyword: uniqueItems
---
30 changes: 30 additions & 0 deletions content/draft3/core/additionalProperties.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
keyword: "additionalProperties"
signature: "Schema | Boolean"
value: This keyword must be set to a valid JSON Schema
summary: "Validation succeeds if the schema validates against each value not matched by other object applicators in this vocabulary. If set to a boolean, no additional properties are allowed in the instance."
kind: [ "applicator" ]
instance: [ "object" ]
specification: "https://json-schema.org/draft-03/draft-zyp-json-schema-03.pdf#5.4"
metaschema: "http://json-schema.org/draft-03/schema#"
tests:
- draft3/additionalProperties.json
default:
value: "{}"
introduced_in: draft1
index: -4
interdependencies:
- vocabulary: core
keyword: properties
- vocabulary: core
keyword: patternProperties
related:
- vocabulary: core
keyword: dependencies
- vocabulary: core
keyword: required
- vocabulary: core
keyword: minProperties
- vocabulary: core
keyword: maxProperties
---
19 changes: 19 additions & 0 deletions content/draft3/core/default.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
keyword: "default"
signature: "Any"
value: This keyword must be set to a JSON value, preferrably that successfully validates against the corresponding subschema
summary: "This keyword can be used to supply a default JSON value associated with a particular schema."
kind: [ "annotation" ]
instance: [ "any" ]
specification: "https://json-schema.org/draft-03/draft-zyp-json-schema-03.pdf#5.20"
metaschema: "http://json-schema.org/draft-03/schema#"
tests:
- draft3/default.json
introduced_in: draft1
index: 9996
related:
- vocabulary: core
keyword: title
- vocabulary: core
keyword: description
---
19 changes: 19 additions & 0 deletions content/draft3/core/dependencies.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
keyword: "dependencies"
signature: "Object<String, Array<String> | Schema>"
value: This keyword must be set to an object where each value is either an array of unique strings or a valid JSON Schema
summary: "Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value, either every item in the corresponding array is also the name of a property in the instance or the corresponding subschema successfully evaluates against the instance."
kind: [ "assertion" ]
instance: [ "object" ]
specification: "https://json-schema.org/draft-03/draft-zyp-json-schema-03.pdf#5.8"
metaschema: "http://json-schema.org/draft-03/schema#"
default:
value: "{}"
index: -3
tests:
- draft3/dependencies.json
introduced_in: draft3
related:
- vocabulary: core
keyword: required
---
17 changes: 17 additions & 0 deletions content/draft3/core/description.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
keyword: "description"
signature: "String"
value: This keyword must be set to a string
summary: "An explanation about the purpose of the instance described by the schema."
kind: [ "annotation" ]
instance: [ "any" ]
specification: "https://json-schema.org/draft-03/draft-zyp-json-schema-03.pdf#5.22"
metaschema: "http://json-schema.org/draft-03/schema#"
introduced_in: draft1
index: 9995
related:
- vocabulary: core
keyword: title
- vocabulary: core
keyword: default
---
17 changes: 17 additions & 0 deletions content/draft3/core/disallow.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
keyword: "disallow"
signature: "String | Array<String>"
value: This keyword is opposite of the `type` keyword. If the instance is set to either a string that corresponds to one of the supported types, or any instance matching the values in a *non-empty* array of unique strings that correspond to one of the supported types, the instance is invalid
summary: "Validation succeeds if the type of the instance does not match the type represented by the given type, or does not match at least one of the given types."
kind: [ "assertion" ]
instance: [ "any" ]
specification: "https://json-schema.org/draft-03/draft-zyp-json-schema-03.pdf#5.25"
metaschema: "http://json-schema.org/draft-03/schema#"
default:
value: "[ \"null\", \"boolean\", \"object\", \"array\", \"number\", \"string\", \"any\"]"
tests:
- draft3/disallow.json
index: -99999
introduced_in: draft1
removed_in: draft4
---
27 changes: 27 additions & 0 deletions content/draft3/core/divisibleBy.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
keyword: "divisibleBy"
signature: "Number"
value: This keyword must be set to a number that is not equal to zero
summary: "A numeric instance is valid only if division by this keyword's value results in an integer."
kind: [ "assertion" ]
instance: [ "number" ]
specification: "https://json-schema.org/draft-03/draft-zyp-json-schema-03.pdf#5.24"
metaschema: "http://json-schema.org/draft-03/schema#"
default:
value: 1
tests:
- draft3/divisibleBy.json
introduced_in: draft3
removed_in: draft4
changed_in: draft4
index: -9999
related:
- vocabulary: core
keyword: exclusiveMaximum
- vocabulary: core
keyword: exclusiveMinimum
- vocabulary: core
keyword: maximum
- vocabulary: core
keyword: minimum
---
19 changes: 19 additions & 0 deletions content/draft3/core/enum.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
keyword: "enum"
signature: "Array<Any>"
value: This keyword must be set to a *non-empty* array of unique JSON values
summary: "Validation succeeds if the instance is equal to one of the elements in this keyword's array value."
kind: [ "assertion" ]
instance: [ "any" ]
specification: "https://json-schema.org/draft-03/draft-zyp-json-schema-03.pdf#5.19"
metaschema: "http://json-schema.org/draft-03/schema#"
tests:
- draft3/enum.json
introduced_in: draft1
index: -99998
related:
- vocabulary: core
keyword: type
- vocabulary: core
keyword: extends
---
52 changes: 52 additions & 0 deletions content/draft3/core/exclusiveMaximum.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
keyword: "exclusiveMaximum"
signature: "Boolean"
value: This keyword must be set to a boolean value
summary: "When [`maximum`](/draft3/validation/maximum) is present and this keyword is set to true, the numeric instance must be less than the value in [`maximum`](/draft3/validation/maximum)."
summary: "Validation succeeds if the numeric instance is less than the given number."
kind: [ "assertion" ]
instance: [ "number" ]
specification: "https://json-schema.org/draft-03/draft-zyp-json-schema-03.pdf#5.12"
metaschema: "http://json-schema.org/draft-03/schema#"
default:
value: "false"
tests:
- draft3/maximum.json
- draft3/optional/bignum.json
introduced_in: draft3
changed_in:
- draft6
index: -9997
affects:
- vocabulary: core
keyword: maximum
related:
- vocabulary: core
keyword: exclusiveMinimum
- vocabulary: core
keyword: maximum
- vocabulary: core
keyword: minimum
- vocabulary: core
keyword: divisibleBy
---

## Examples

{{<schema `Schema with 'exclusiveMaximum' keyword`>}}
{
"$schema": "http://json-schema.org/draft-03/schema#",
"type": "number",
"maximum": 3.0,
"exclusiveMaximum: true
}
{{</schema>}}

{{<instance-pass `A numeric instance less than the maximum with the exclusiveMaximum keyword defined is valid`>}}
2.2
{{</instance-pass>}}


{{<instance-fail `A numeric instance greater than or equal to the maximum with the exclusiveMaximum keyword defined is invalid`>}}
3.0
{{</instance-fail>}}
50 changes: 50 additions & 0 deletions content/draft3/core/exclusiveMinimum.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
keyword: "exclusiveMinimum"
signature: "Boolean"
value: This keyword must be set to a boolean value
summary: "When [`minimum`](/draft3/validation/minimum) is present and this keyword is set to true, the numeric instance must be greater than the value in [`minimum`](/draft3/validation/minimum)."
kind: [ "assertion" ]
instance: [ "number" ]
specification: "https://json-schema.org/draft-03/draft-zyp-json-schema-03.pdf#5.11"
metaschema: "http://json-schema.org/draft-03/schema#"
default:
value: "false"
tests:
- draft3/minimum.json
- draft3/optional/bignum.json
introduced_in: draft3
changed_in:
- draft6
index: -9995
affects:
- vocabulary: core
keyword: minimum
related:
- vocabulary: core
keyword: exclusiveMaximum
- vocabulary: core
keyword: maximum
- vocabulary: core
keyword: minimum
- vocabulary: core
keyword: divisibleBy
---

## Examples

{{<schema `Schema with 'exclusiveMinimum' keyword`>}}
{
"$schema": "http://json-schema.org/draft-03/schema#",
"type": "number",
"minimum": 1.1,
"exclusiveMinimum: true
}
{{</schema>}}

{{<instance-pass `A numeric instance greater than the minimum with the exclusiveMinimum keyword defined is valid`>}}
1.2
{{</instance-pass>}}

{{<instance-fail `A numeric instance less than or equal to the minimum with the exclusiveMinimum keyword defined is invalid`>}}
1.1
{{</instance-fail>}}
20 changes: 20 additions & 0 deletions content/draft3/core/extends.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
keyword: "extends"
signature: "URI Reference | Schema | Array<Schema>"
value: This keyword must be set to either a schema, a list of schemas, or a URI that points to a schema
summary: "Validation succeeds if the instance is valid against the schema or schemas defined by this keyword"
kind: [ "applicator" ]
instance: [ "any" ]
specification: "https://json-schema.org/draft-03/draft-zyp-json-schema-03.pdf#5.26"
metaschema: "http://json-schema.org/draft-03/schema#"
default:
logical_value: "[]"
tests:
- draft3/extends.json
index: 6
introduced_in: draft1
removed_in: draft4
related:
- vocabulary: core
keyword: enum
---
17 changes: 17 additions & 0 deletions content/draft3/core/format.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
keyword: "format"
signature: "String"
value: This keyword must be set to a string, preferrably one that is standardized by JSON Schema to ensure interoperability
summary: "Define semantic information about a string instance."
kind: [ "annotation" ]
instance: [ "string" ]
specification: "https://json-schema.org/draft-03/draft-zyp-json-schema-03.pdf#5.23"
metaschema: "http://json-schema.org/draft-03/schema#"
tests:
- draft3/format.json
introduced_in: draft1
index: 97
changed_in:
- draft3
- draft4
---
19 changes: 19 additions & 0 deletions content/draft3/core/id.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
keyword: "id"
signature: "URI Reference"
value: This keyword may be set to an absolute URI or a relative reference
summary: "This keyword declares an identifier for the schema resource."
kind: [ "identifier" ]
instance: [ "any" ]
specification: "https://json-schema.org/draft-03/draft-zyp-json-schema-03.pdf#5.27"
metaschema: "http://json-schema.org/draft-03/schema#"
tests:
index: -999
introduced_in: draft3
affects:
- vocabulary: core
keyword: $ref
related:
- vocabulary: core
keyword: $schema
---
29 changes: 29 additions & 0 deletions content/draft3/core/items.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
keyword: "items"
signature: "Schema | Array<Schema>"
value: This keyword must be set to a valid JSON Schema or to a *non-empty* array, where each item is a valid JSON Schema
summary: "If set to a schema, validation succeeds if each element of the instance validates against it. If set to an array, validation succeeds if each element of the instance validates against the schema at the same position, if any."
kind: [ "applicator" ]
instance: [ "array" ]
specification: "https://json-schema.org/draft-03/draft-zyp-json-schema-03.pdf#5.5"
metaschema: "http://json-schema.org/draft-03/schema#"
default:
value: "{}"
tests:
- draft3/items.json
introduced_in: draft1
index: -99
interdependencies:
- vocabulary: core
keyword: minItems
- vocabulary: core
keyword: maxItems
affects:
- vocabulary: core
keyword: additionalItems
related:
- vocabulary: core
keyword: additionalItems
- vocabulary: core
keyword: uniqueItems
---
Loading

0 comments on commit 07b6424

Please sign in to comment.