You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| not present |`$schema`|`core`| Identifier | The `$schema` keyword specifies the URI of the JSON Schema that defines the schema of the current document. Validators use this URI to resolve links and determine the JSON Schema version, enabling appropriate validation features. Including the `$schema` keyword is recommended to ensure compatibility with future JSON Schema changes. |
15
-
| not present |`$ref`|`core`| Applicator |`$ref` key references an external schema URI for validation. |
16
-
| not present |`id`|`core`| Identifier | This keyword defines the schema's current URI (a "self" link). The URI can be relative or absolute and is resolved against the parent schema's URI. If there is no parent schema, it is resolved against the URI used to retrieve the schema. |
17
-
|`optional`|`required`|`core`| Assertion | In **draft-02**, object properties defined within the `properties` keyword were required by default, and the `optional` keyword was used to explicitly make a property optional. In **draft-03**, this behavior changed: properties defined under `properties` are now optional by default. As a result, the `optional` keyword became redundant and was replaced by the `required` keyword to reflect the new default behavior, where properties are optional unless explicitly marked as required. |
18
-
|`minimumCanEqual`|`exclusiveMinimum`|`core`| Assertion | Specifies that instance values must be strictly greater than the minimum when `exclusiveMinimum` is `true`. |
19
-
|`maximumCanEqual`|`exclusiveMaximum`|`core`| Assertion | This ensures that instance values fall below the maximum when `exclusiveMaximum` is `true`. |
20
-
|`format`|`format`|`core`| Annotation | This update refined format handling by adding and removing specific types, offering clearer guidance for expected data formats. |
21
-
| not present |`patternProperties`|`core`| Applicator | Enforces schema validation on properties with names matching specified regex patterns. Each property matching a pattern must conform to the schema defined for that pattern in `patternProperties`. |
22
-
|`requires`|`dependencies`|`core`| Assertion | Defines property dependencies - if an instance includes a property named in this attribute, that property must meet additional validation requirements defined by its dependency value. |
23
-
| not present |`additionalItems`|`core`| Applicator | Defines rules for extra items in an array - can be set to false to disallow extra items beyond specified tuples, or to a schema that additional items must follow. |
24
-
|`alternate`| removed |`core`|| - |
14
+
| not present |`$schema`|`Core`| Identifier | The `$schema` keyword specifies the URI of the JSON Schema that defines the schema of the current document. Validators use this URI to resolve links and determine the JSON Schema version, enabling appropriate validation features. Including the `$schema` keyword is recommended to ensure compatibility with future JSON Schema changes. |
15
+
| not present |`$ref`|`Core`| Applicator |`$ref` key references an external schema URI for validation. |
16
+
| not present |`id`|`Core`| Identifier | This keyword defines the schema's current URI (a "self" link). The URI can be relative or absolute and is resolved against the parent schema's URI. If there is no parent schema, it is resolved against the URI used to retrieve the schema. |
17
+
|`optional`|`required`|`Core`| Assertion | In **draft-02**, object properties defined within the `properties` keyword were required by default, and the `optional` keyword was used to explicitly make a property optional. In **draft-03**, this behavior changed: properties defined under `properties` are now optional by default. As a result, the `optional` keyword became redundant and was replaced by the `required` keyword to reflect the new default behavior, where properties are optional unless explicitly marked as required. |
18
+
|`minimumCanEqual`|`exclusiveMinimum`|`Core`| Assertion | Specifies that instance values must be strictly greater than the minimum when `exclusiveMinimum` is `true`. |
19
+
|`maximumCanEqual`|`exclusiveMaximum`|`Core`| Assertion | This ensures that instance values fall below the maximum when `exclusiveMaximum` is `true`. |
20
+
|`format`|`format`|`Core`| Annotation | This update refined format handling by adding and removing specific types, offering clearer guidance for expected data formats. |
21
+
| not present |`patternProperties`|`Core`| Applicator | Enforces schema validation on properties with names matching specified regex patterns. Each property matching a pattern must conform to the schema defined for that pattern in `patternProperties`. |
22
+
|`requires`|`dependencies`|`Core`| Assertion | Defines property dependencies - if an instance includes a property named in this attribute, that property must meet additional validation requirements defined by its dependency value. |
23
+
| not present |`additionalItems`|`Core`| Applicator | Defines rules for extra items in an array - can be set to false to disallow extra items beyond specified tuples, or to a schema that additional items must follow. |
24
+
|`properties`| remained `properties`|`Core`| Applicator | The `properties` takes two values, either `optional` or `required`; where `optional `, is the default value. |
25
+
|`alternate`| removed |`Core`|| - |
25
26
26
27
### Tutorial
27
28
28
29
#### Step 1: Review Core Changes
29
30
30
31
Start by understanding the key differences between Draft 2 and Draft 3, especially regarding core changes in $schema, $ref, and validation keywords.
31
32
32
-
-`$schema`: In Draft 3, this remains the same but is now more standardized to handle the schema dialect and the version of the specification being used.
33
-
-`$ref`: Draft 3 introduces the `$ref` keyword, which allows referencing external schemas for validation. This will enable more modular and reusable schema definitions.
33
+
-`$schema`: Draft 3 introduces the `$schema` keyword, it handles the schema dialect and the version of the specification being used.
34
+
-`$ref`: Draft 3 introduces the `$ref` keyword, which allows referencing external schemas for validation and schemas within the same schema document. This will enable more modular and reusable schema definitions.
Copy file name to clipboardExpand all lines: pages/draft-04/migration-notes.md
+3-6Lines changed: 3 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Below is a summary table highlighting keyword changes between Draft 3 and Draft
21
21
|`required`|`required`| Validation | Assertion | The `required` keyword shifted from being a boolean within each property to a standalone keyword that takes an array of required property names outside of properties. |
22
22
|`divisibleBy`|`multipleOf`| Validation | Assertion |`divisibleBy` was renamed to `multipleOf` with a stricter requirement that its value must be greater than 0. |
23
23
|`extends`| removed | Validation | Applicator | The `extends` keyword was removed; allOf was added as a new keyword to achieve similar functionality. |
24
-
|`format`|`format`| Validation | Annotation |- |
24
+
|`format`|`format`| Validation | Annotation |The attributes `phone`, `style`, and `color` have been removed and ip-address has been renamed to `ipv4`.|
25
25
|`dependencies`|`dependencies`| Core | Assertion | The `dependencies` member values were changed to require an array of strings or a schema, eliminating the use of single strings. |
26
26
|`id`|`id`| Core | Identifier | - |
27
27
| Not present |`allOf`| Core | Applicator | - |
@@ -58,16 +58,13 @@ The `allOf` keyword has now replaced the previous type schema functionality.
58
58
In Draft 3, these identifiers were considered valid:
59
59
60
60
```json
61
-
id: ""
62
-
id: "#"
61
+
"id": ""
62
+
"id": "#"
63
63
```
64
64
65
65
However, this format is now prohibited from Draft 4 onwards.
66
66
</Infobox>
67
67
68
-
<Infoboxlabel="Note">
69
-
Before Draft 3, the JSON Schema only included the Core specification, which outlined the foundational elements for schema structure. With Draft 4, the specification expanded to incorporate Validation, establishing rules for data format, structure, and type requirements. This addition enabled schema authors to define and enforce validation constraints directly within their schemas, making it easier for implementers to ensure data integrity and compatibility as schemas evolved.
| $anchor | remained $anchor | Core || In 2019-09, $anchor could use a colon and not start with an underscore, but in 2020-12, the upgrade in syntax rule can't use a colon. |
15
-
| $schema | remained $schema | Core || The behavior was updated to use dialect 2020-12 |
16
-
| $recursiveAnchor |`$dynamicAnchor`| Core | Identifier | Similar to `$anchor`, but supports `$dynamicRef` for flexible schema resolution and $dynamicAnchor now has its own syntax. |
17
-
| $recursiveRef |`$dynamicRef`| Core | Applicator | Works with `$dynamicAnchor` to allow referencing dynamically resolved schemas at runtime. |
18
-
| $vocabulary |`$vocabulary`| Core || Specifies which vocabularies a schema uses in 2019-09, but the update now uses format-annotation aiding compatibility and extensibility. |
14
+
|` $anchor`| remained `$anchor`| Core || In 2019-09, $anchor could use a colon and not start with an underscore, but in 2020-12, the upgrade in syntax rule can't use a colon. |
15
+
|`$schema`| remained` $schema`| Core || The behavior was updated to use dialect 2020-12 |
16
+
|`$recursiveAnchor`|`$dynamicAnchor`| Core | Identifier | Similar to `$anchor`, but supports `$dynamicRef` for flexible schema resolution. |
17
+
|` $recursiveRef`|`$dynamicRef`| Core | Applicator | Works with `$dynamicAnchor` to allow referencing dynamically resolved schemas at runtime. |
18
+
|`$vocabulary`|`$vocabulary`| Core || Specifies which vocabularies a schema uses in 2019-09, but the update now uses format-annotation aiding compatibility and extensibility. |
19
19
|`items` (used for both lists and tuples) |`prefixItems`| Core | Applicator | Separates tuple validation (`prefixItems`) from list validation (`items`). Now, `items` applies only to additional elements beyond `prefixItems`. |
0 commit comments