z-schema 10.0.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -17
- package/cjs/index.d.ts +345 -34
- package/cjs/index.js +4446 -1685
- package/dist/errors.js +5 -0
- package/dist/format-validators.js +131 -107
- package/dist/json-schema-versions.js +4 -1
- package/dist/json-schema.js +50 -16
- package/dist/json-validation.js +524 -669
- package/dist/report.js +37 -16
- package/dist/schema-cache.js +76 -18
- package/dist/schema-compiler.js +72 -47
- package/dist/schema-validator.js +117 -52
- package/dist/schemas/draft-07-schema.json +172 -0
- package/dist/schemas/draft-2019-09-meta-applicator.json +52 -0
- package/dist/schemas/draft-2019-09-meta-content.json +12 -0
- package/dist/schemas/draft-2019-09-meta-core.json +53 -0
- package/dist/schemas/draft-2019-09-meta-format.json +10 -0
- package/dist/schemas/draft-2019-09-meta-meta-data.json +32 -0
- package/dist/schemas/draft-2019-09-meta-validation.json +94 -0
- package/dist/schemas/draft-2019-09-schema.json +41 -0
- package/dist/schemas/draft-2020-12-meta-applicator.json +44 -0
- package/dist/schemas/draft-2020-12-meta-content.json +12 -0
- package/dist/schemas/draft-2020-12-meta-core.json +47 -0
- package/dist/schemas/draft-2020-12-meta-format-annotation.json +10 -0
- package/dist/schemas/draft-2020-12-meta-format-assertion.json +10 -0
- package/dist/schemas/draft-2020-12-meta-meta-data.json +32 -0
- package/dist/schemas/draft-2020-12-meta-unevaluated.json +11 -0
- package/dist/schemas/draft-2020-12-meta-validation.json +94 -0
- package/dist/schemas/draft-2020-12-schema.json +57 -0
- package/dist/types/errors.d.ts +4 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/json-schema-versions.d.ts +128 -9
- package/dist/types/json-schema.d.ts +28 -11
- package/dist/types/json-validation.d.ts +2 -3
- package/dist/types/report.d.ts +14 -4
- package/dist/types/schema-cache.d.ts +7 -0
- package/dist/types/schema-compiler.d.ts +5 -3
- package/dist/types/schema-validator.d.ts +2 -2
- package/dist/types/utils/array.d.ts +8 -1
- package/dist/types/utils/base64.d.ts +2 -0
- package/dist/types/utils/clone.d.ts +1 -1
- package/dist/types/utils/date.d.ts +1 -0
- package/dist/types/utils/hostname.d.ts +2 -0
- package/dist/types/utils/json.d.ts +2 -1
- package/dist/types/utils/properties.d.ts +0 -1
- package/dist/types/utils/time.d.ts +12 -0
- package/dist/types/utils/unicode.d.ts +3 -12
- package/dist/types/validation/array.d.ts +12 -0
- package/dist/types/validation/combinators.d.ts +10 -0
- package/dist/types/validation/numeric.d.ts +8 -0
- package/dist/types/validation/object.d.ts +13 -0
- package/dist/types/validation/ref.d.ts +11 -0
- package/dist/types/validation/shared.d.ts +26 -0
- package/dist/types/validation/string.d.ts +9 -0
- package/dist/types/validation/type.d.ts +6 -0
- package/dist/types/z-schema-base.d.ts +39 -1
- package/dist/types/z-schema-options.d.ts +3 -0
- package/dist/types/z-schema.d.ts +144 -8
- package/dist/utils/array.js +49 -7
- package/dist/utils/base64.js +29 -0
- package/dist/utils/clone.js +13 -12
- package/dist/utils/date.js +21 -0
- package/dist/utils/hostname.js +146 -0
- package/dist/utils/json.js +11 -6
- package/dist/utils/properties.js +1 -6
- package/dist/utils/time.js +50 -0
- package/dist/utils/unicode.js +8 -41
- package/dist/utils/uri.js +1 -1
- package/dist/validation/array.js +128 -0
- package/dist/validation/combinators.js +107 -0
- package/dist/validation/numeric.js +97 -0
- package/dist/validation/object.js +238 -0
- package/dist/validation/ref.js +70 -0
- package/dist/validation/shared.js +136 -0
- package/dist/validation/string.js +178 -0
- package/dist/validation/type.js +55 -0
- package/dist/z-schema-base.js +52 -32
- package/dist/z-schema-options.js +12 -8
- package/dist/z-schema-versions.js +92 -9
- package/dist/z-schema.js +135 -38
- package/package.json +22 -8
- package/src/errors.ts +8 -0
- package/src/format-validators.ts +146 -105
- package/src/index.ts +10 -1
- package/src/json-schema-versions.ts +181 -11
- package/src/json-schema.ts +102 -35
- package/src/json-validation.ts +653 -724
- package/src/report.ts +42 -20
- package/src/schema-cache.ts +94 -18
- package/src/schema-compiler.ts +94 -51
- package/src/schema-validator.ts +132 -56
- package/src/schemas/draft-07-schema.json +172 -0
- package/src/schemas/draft-2019-09-meta-applicator.json +53 -0
- package/src/schemas/draft-2019-09-meta-content.json +14 -0
- package/src/schemas/draft-2019-09-meta-core.json +54 -0
- package/src/schemas/draft-2019-09-meta-format.json +11 -0
- package/src/schemas/draft-2019-09-meta-meta-data.json +34 -0
- package/src/schemas/draft-2019-09-meta-validation.json +95 -0
- package/src/schemas/draft-2019-09-schema.json +42 -0
- package/src/schemas/draft-2020-12-meta-applicator.json +45 -0
- package/src/schemas/draft-2020-12-meta-content.json +14 -0
- package/src/schemas/draft-2020-12-meta-core.json +48 -0
- package/src/schemas/draft-2020-12-meta-format-annotation.json +11 -0
- package/src/schemas/draft-2020-12-meta-format-assertion.json +11 -0
- package/src/schemas/draft-2020-12-meta-meta-data.json +34 -0
- package/src/schemas/draft-2020-12-meta-unevaluated.json +12 -0
- package/src/schemas/draft-2020-12-meta-validation.json +95 -0
- package/src/schemas/draft-2020-12-schema.json +58 -0
- package/src/utils/array.ts +51 -7
- package/src/utils/base64.ts +32 -0
- package/src/utils/clone.ts +16 -12
- package/src/utils/date.ts +23 -0
- package/src/utils/hostname.ts +174 -0
- package/src/utils/json.ts +15 -6
- package/src/utils/properties.ts +1 -7
- package/src/utils/time.ts +73 -0
- package/src/utils/unicode.ts +8 -39
- package/src/utils/uri.ts +1 -1
- package/src/validation/array.ts +158 -0
- package/src/validation/combinators.ts +132 -0
- package/src/validation/numeric.ts +120 -0
- package/src/validation/object.ts +318 -0
- package/src/validation/ref.ts +85 -0
- package/src/validation/shared.ts +191 -0
- package/src/validation/string.ts +224 -0
- package/src/validation/type.ts +66 -0
- package/src/z-schema-base.ts +54 -36
- package/src/z-schema-options.ts +15 -8
- package/src/z-schema-versions.ts +107 -12
- package/src/z-schema.ts +158 -42
- package/umd/ZSchema.js +4446 -1685
- package/umd/ZSchema.min.js +1 -1
- package/dist/schemas/draft-04-hyper-schema.json +0 -135
- package/dist/schemas/draft-06-hyper-schema.json +0 -132
- package/dist/schemas/draft-06-links.json +0 -43
- package/src/schemas/draft-04-hyper-schema.json +0 -136
- package/src/schemas/draft-06-hyper-schema.json +0 -133
- package/src/schemas/draft-06-links.json +0 -43
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
|
3
|
+
"$id": "https://json-schema.org/draft/2019-09/meta/meta-data",
|
|
4
|
+
"$recursiveAnchor": true,
|
|
5
|
+
"title": "Meta-data vocabulary meta-schema",
|
|
6
|
+
"type": ["object", "boolean"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"title": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"description": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"default": true,
|
|
15
|
+
"deprecated": {
|
|
16
|
+
"type": "boolean",
|
|
17
|
+
"default": false
|
|
18
|
+
},
|
|
19
|
+
"readOnly": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"default": false
|
|
22
|
+
},
|
|
23
|
+
"writeOnly": {
|
|
24
|
+
"type": "boolean",
|
|
25
|
+
"default": false
|
|
26
|
+
},
|
|
27
|
+
"examples": {
|
|
28
|
+
"type": "array",
|
|
29
|
+
"items": true
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
|
3
|
+
"$id": "https://json-schema.org/draft/2019-09/meta/validation",
|
|
4
|
+
"$recursiveAnchor": true,
|
|
5
|
+
"title": "Validation vocabulary meta-schema",
|
|
6
|
+
"type": ["object", "boolean"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"multipleOf": {
|
|
9
|
+
"type": "number",
|
|
10
|
+
"exclusiveMinimum": 0
|
|
11
|
+
},
|
|
12
|
+
"maximum": {
|
|
13
|
+
"type": "number"
|
|
14
|
+
},
|
|
15
|
+
"exclusiveMaximum": {
|
|
16
|
+
"type": "number"
|
|
17
|
+
},
|
|
18
|
+
"minimum": {
|
|
19
|
+
"type": "number"
|
|
20
|
+
},
|
|
21
|
+
"exclusiveMinimum": {
|
|
22
|
+
"type": "number"
|
|
23
|
+
},
|
|
24
|
+
"maxLength": { "$ref": "#/$defs/nonNegativeInteger" },
|
|
25
|
+
"minLength": { "$ref": "#/$defs/nonNegativeIntegerDefault0" },
|
|
26
|
+
"pattern": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"format": "regex"
|
|
29
|
+
},
|
|
30
|
+
"maxItems": { "$ref": "#/$defs/nonNegativeInteger" },
|
|
31
|
+
"minItems": { "$ref": "#/$defs/nonNegativeIntegerDefault0" },
|
|
32
|
+
"uniqueItems": {
|
|
33
|
+
"type": "boolean",
|
|
34
|
+
"default": false
|
|
35
|
+
},
|
|
36
|
+
"maxContains": { "$ref": "#/$defs/nonNegativeInteger" },
|
|
37
|
+
"minContains": {
|
|
38
|
+
"$ref": "#/$defs/nonNegativeInteger",
|
|
39
|
+
"default": 1
|
|
40
|
+
},
|
|
41
|
+
"maxProperties": { "$ref": "#/$defs/nonNegativeInteger" },
|
|
42
|
+
"minProperties": { "$ref": "#/$defs/nonNegativeIntegerDefault0" },
|
|
43
|
+
"required": { "$ref": "#/$defs/stringArray" },
|
|
44
|
+
"dependentRequired": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"additionalProperties": {
|
|
47
|
+
"$ref": "#/$defs/stringArray"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"const": true,
|
|
51
|
+
"enum": {
|
|
52
|
+
"type": "array",
|
|
53
|
+
"items": true
|
|
54
|
+
},
|
|
55
|
+
"type": {
|
|
56
|
+
"anyOf": [
|
|
57
|
+
{ "$ref": "#/$defs/simpleTypes" },
|
|
58
|
+
{
|
|
59
|
+
"type": "array",
|
|
60
|
+
"items": { "$ref": "#/$defs/simpleTypes" },
|
|
61
|
+
"minItems": 1,
|
|
62
|
+
"uniqueItems": true
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"$defs": {
|
|
68
|
+
"nonNegativeInteger": {
|
|
69
|
+
"type": "integer",
|
|
70
|
+
"minimum": 0
|
|
71
|
+
},
|
|
72
|
+
"nonNegativeIntegerDefault0": {
|
|
73
|
+
"$ref": "#/$defs/nonNegativeInteger",
|
|
74
|
+
"default": 0
|
|
75
|
+
},
|
|
76
|
+
"simpleTypes": {
|
|
77
|
+
"enum": [
|
|
78
|
+
"array",
|
|
79
|
+
"boolean",
|
|
80
|
+
"integer",
|
|
81
|
+
"null",
|
|
82
|
+
"number",
|
|
83
|
+
"object",
|
|
84
|
+
"string"
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"stringArray": {
|
|
88
|
+
"type": "array",
|
|
89
|
+
"items": { "type": "string" },
|
|
90
|
+
"uniqueItems": true,
|
|
91
|
+
"default": []
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
|
3
|
+
"$id": "https://json-schema.org/draft/2019-09/schema",
|
|
4
|
+
"$vocabulary": {
|
|
5
|
+
"https://json-schema.org/draft/2019-09/vocab/core": true,
|
|
6
|
+
"https://json-schema.org/draft/2019-09/vocab/applicator": true,
|
|
7
|
+
"https://json-schema.org/draft/2019-09/vocab/validation": true,
|
|
8
|
+
"https://json-schema.org/draft/2019-09/vocab/meta-data": true,
|
|
9
|
+
"https://json-schema.org/draft/2019-09/vocab/format": false,
|
|
10
|
+
"https://json-schema.org/draft/2019-09/vocab/content": true
|
|
11
|
+
},
|
|
12
|
+
"$recursiveAnchor": true,
|
|
13
|
+
"title": "Core and Validation specifications meta-schema",
|
|
14
|
+
"allOf": [
|
|
15
|
+
{ "$ref": "meta/core" },
|
|
16
|
+
{ "$ref": "meta/applicator" },
|
|
17
|
+
{ "$ref": "meta/validation" },
|
|
18
|
+
{ "$ref": "meta/meta-data" },
|
|
19
|
+
{ "$ref": "meta/format" },
|
|
20
|
+
{ "$ref": "meta/content" }
|
|
21
|
+
],
|
|
22
|
+
"type": ["object", "boolean"],
|
|
23
|
+
"properties": {
|
|
24
|
+
"definitions": {
|
|
25
|
+
"$comment": "While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",
|
|
26
|
+
"type": "object",
|
|
27
|
+
"additionalProperties": { "$recursiveRef": "#" },
|
|
28
|
+
"default": {}
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"dependentSchemas\" and \"dependentRequired\"",
|
|
32
|
+
"type": "object",
|
|
33
|
+
"additionalProperties": {
|
|
34
|
+
"anyOf": [
|
|
35
|
+
{ "$recursiveRef": "#" },
|
|
36
|
+
{ "$ref": "meta/validation#/$defs/stringArray" }
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://json-schema.org/draft/2020-12/meta/applicator",
|
|
4
|
+
"$dynamicAnchor": "meta",
|
|
5
|
+
"title": "Applicator vocabulary meta-schema",
|
|
6
|
+
"type": ["object", "boolean"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"prefixItems": { "$ref": "#/$defs/schemaArray" },
|
|
9
|
+
"items": { "$dynamicRef": "#meta" },
|
|
10
|
+
"contains": { "$dynamicRef": "#meta" },
|
|
11
|
+
"additionalProperties": { "$dynamicRef": "#meta" },
|
|
12
|
+
"properties": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"additionalProperties": { "$dynamicRef": "#meta" },
|
|
15
|
+
"default": {}
|
|
16
|
+
},
|
|
17
|
+
"patternProperties": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"additionalProperties": { "$dynamicRef": "#meta" },
|
|
20
|
+
"propertyNames": { "format": "regex" },
|
|
21
|
+
"default": {}
|
|
22
|
+
},
|
|
23
|
+
"dependentSchemas": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"additionalProperties": { "$dynamicRef": "#meta" },
|
|
26
|
+
"default": {}
|
|
27
|
+
},
|
|
28
|
+
"propertyNames": { "$dynamicRef": "#meta" },
|
|
29
|
+
"if": { "$dynamicRef": "#meta" },
|
|
30
|
+
"then": { "$dynamicRef": "#meta" },
|
|
31
|
+
"else": { "$dynamicRef": "#meta" },
|
|
32
|
+
"allOf": { "$ref": "#/$defs/schemaArray" },
|
|
33
|
+
"anyOf": { "$ref": "#/$defs/schemaArray" },
|
|
34
|
+
"oneOf": { "$ref": "#/$defs/schemaArray" },
|
|
35
|
+
"not": { "$dynamicRef": "#meta" }
|
|
36
|
+
},
|
|
37
|
+
"$defs": {
|
|
38
|
+
"schemaArray": {
|
|
39
|
+
"type": "array",
|
|
40
|
+
"minItems": 1,
|
|
41
|
+
"items": { "$dynamicRef": "#meta" }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://json-schema.org/draft/2020-12/meta/content",
|
|
4
|
+
"$dynamicAnchor": "meta",
|
|
5
|
+
"title": "Content vocabulary meta-schema",
|
|
6
|
+
"type": ["object", "boolean"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"contentEncoding": { "type": "string" },
|
|
9
|
+
"contentMediaType": { "type": "string" },
|
|
10
|
+
"contentSchema": { "$dynamicRef": "#meta" }
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://json-schema.org/draft/2020-12/meta/core",
|
|
4
|
+
"$dynamicAnchor": "meta",
|
|
5
|
+
"title": "Core vocabulary meta-schema",
|
|
6
|
+
"type": ["object", "boolean"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"$id": {
|
|
9
|
+
"$ref": "#/$defs/uriReferenceString",
|
|
10
|
+
"$comment": "Non-empty fragments not allowed.",
|
|
11
|
+
"pattern": "^[^#]*#?$"
|
|
12
|
+
},
|
|
13
|
+
"$schema": { "$ref": "#/$defs/uriString" },
|
|
14
|
+
"$ref": { "$ref": "#/$defs/uriReferenceString" },
|
|
15
|
+
"$anchor": { "$ref": "#/$defs/anchorString" },
|
|
16
|
+
"$dynamicRef": { "$ref": "#/$defs/uriReferenceString" },
|
|
17
|
+
"$dynamicAnchor": { "$ref": "#/$defs/anchorString" },
|
|
18
|
+
"$vocabulary": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"propertyNames": { "$ref": "#/$defs/uriString" },
|
|
21
|
+
"additionalProperties": {
|
|
22
|
+
"type": "boolean"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"$comment": {
|
|
26
|
+
"type": "string"
|
|
27
|
+
},
|
|
28
|
+
"$defs": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"additionalProperties": { "$dynamicRef": "#meta" }
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"$defs": {
|
|
34
|
+
"anchorString": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"pattern": "^[A-Za-z_][-A-Za-z0-9._]*$"
|
|
37
|
+
},
|
|
38
|
+
"uriString": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"format": "uri"
|
|
41
|
+
},
|
|
42
|
+
"uriReferenceString": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"format": "uri-reference"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://json-schema.org/draft/2020-12/meta/format-annotation",
|
|
4
|
+
"$dynamicAnchor": "meta",
|
|
5
|
+
"title": "Format vocabulary meta-schema for annotation results",
|
|
6
|
+
"type": ["object", "boolean"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"format": { "type": "string" }
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://json-schema.org/draft/2020-12/meta/format-assertion",
|
|
4
|
+
"$dynamicAnchor": "meta",
|
|
5
|
+
"title": "Format vocabulary meta-schema for assertion results",
|
|
6
|
+
"type": ["object", "boolean"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"format": { "type": "string" }
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://json-schema.org/draft/2020-12/meta/meta-data",
|
|
4
|
+
"$dynamicAnchor": "meta",
|
|
5
|
+
"title": "Meta-data vocabulary meta-schema",
|
|
6
|
+
"type": ["object", "boolean"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"title": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"description": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"default": true,
|
|
15
|
+
"deprecated": {
|
|
16
|
+
"type": "boolean",
|
|
17
|
+
"default": false
|
|
18
|
+
},
|
|
19
|
+
"readOnly": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"default": false
|
|
22
|
+
},
|
|
23
|
+
"writeOnly": {
|
|
24
|
+
"type": "boolean",
|
|
25
|
+
"default": false
|
|
26
|
+
},
|
|
27
|
+
"examples": {
|
|
28
|
+
"type": "array",
|
|
29
|
+
"items": true
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://json-schema.org/draft/2020-12/meta/unevaluated",
|
|
4
|
+
"$dynamicAnchor": "meta",
|
|
5
|
+
"title": "Unevaluated applicator vocabulary meta-schema",
|
|
6
|
+
"type": ["object", "boolean"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"unevaluatedItems": { "$dynamicRef": "#meta" },
|
|
9
|
+
"unevaluatedProperties": { "$dynamicRef": "#meta" }
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://json-schema.org/draft/2020-12/meta/validation",
|
|
4
|
+
"$dynamicAnchor": "meta",
|
|
5
|
+
"title": "Validation vocabulary meta-schema",
|
|
6
|
+
"type": ["object", "boolean"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"type": {
|
|
9
|
+
"anyOf": [
|
|
10
|
+
{ "$ref": "#/$defs/simpleTypes" },
|
|
11
|
+
{
|
|
12
|
+
"type": "array",
|
|
13
|
+
"items": { "$ref": "#/$defs/simpleTypes" },
|
|
14
|
+
"minItems": 1,
|
|
15
|
+
"uniqueItems": true
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"const": true,
|
|
20
|
+
"enum": {
|
|
21
|
+
"type": "array",
|
|
22
|
+
"items": true
|
|
23
|
+
},
|
|
24
|
+
"multipleOf": {
|
|
25
|
+
"type": "number",
|
|
26
|
+
"exclusiveMinimum": 0
|
|
27
|
+
},
|
|
28
|
+
"maximum": {
|
|
29
|
+
"type": "number"
|
|
30
|
+
},
|
|
31
|
+
"exclusiveMaximum": {
|
|
32
|
+
"type": "number"
|
|
33
|
+
},
|
|
34
|
+
"minimum": {
|
|
35
|
+
"type": "number"
|
|
36
|
+
},
|
|
37
|
+
"exclusiveMinimum": {
|
|
38
|
+
"type": "number"
|
|
39
|
+
},
|
|
40
|
+
"maxLength": { "$ref": "#/$defs/nonNegativeInteger" },
|
|
41
|
+
"minLength": { "$ref": "#/$defs/nonNegativeIntegerDefault0" },
|
|
42
|
+
"pattern": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"format": "regex"
|
|
45
|
+
},
|
|
46
|
+
"maxItems": { "$ref": "#/$defs/nonNegativeInteger" },
|
|
47
|
+
"minItems": { "$ref": "#/$defs/nonNegativeIntegerDefault0" },
|
|
48
|
+
"uniqueItems": {
|
|
49
|
+
"type": "boolean",
|
|
50
|
+
"default": false
|
|
51
|
+
},
|
|
52
|
+
"maxContains": { "$ref": "#/$defs/nonNegativeInteger" },
|
|
53
|
+
"minContains": {
|
|
54
|
+
"$ref": "#/$defs/nonNegativeInteger",
|
|
55
|
+
"default": 1
|
|
56
|
+
},
|
|
57
|
+
"maxProperties": { "$ref": "#/$defs/nonNegativeInteger" },
|
|
58
|
+
"minProperties": { "$ref": "#/$defs/nonNegativeIntegerDefault0" },
|
|
59
|
+
"required": { "$ref": "#/$defs/stringArray" },
|
|
60
|
+
"dependentRequired": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"additionalProperties": {
|
|
63
|
+
"$ref": "#/$defs/stringArray"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"$defs": {
|
|
68
|
+
"nonNegativeInteger": {
|
|
69
|
+
"type": "integer",
|
|
70
|
+
"minimum": 0
|
|
71
|
+
},
|
|
72
|
+
"nonNegativeIntegerDefault0": {
|
|
73
|
+
"$ref": "#/$defs/nonNegativeInteger",
|
|
74
|
+
"default": 0
|
|
75
|
+
},
|
|
76
|
+
"simpleTypes": {
|
|
77
|
+
"enum": [
|
|
78
|
+
"array",
|
|
79
|
+
"boolean",
|
|
80
|
+
"integer",
|
|
81
|
+
"null",
|
|
82
|
+
"number",
|
|
83
|
+
"object",
|
|
84
|
+
"string"
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"stringArray": {
|
|
88
|
+
"type": "array",
|
|
89
|
+
"items": { "type": "string" },
|
|
90
|
+
"uniqueItems": true,
|
|
91
|
+
"default": []
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://json-schema.org/draft/2020-12/schema",
|
|
4
|
+
"$vocabulary": {
|
|
5
|
+
"https://json-schema.org/draft/2020-12/vocab/core": true,
|
|
6
|
+
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
|
|
7
|
+
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
|
|
8
|
+
"https://json-schema.org/draft/2020-12/vocab/validation": true,
|
|
9
|
+
"https://json-schema.org/draft/2020-12/vocab/meta-data": true,
|
|
10
|
+
"https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
|
|
11
|
+
"https://json-schema.org/draft/2020-12/vocab/content": true
|
|
12
|
+
},
|
|
13
|
+
"$dynamicAnchor": "meta",
|
|
14
|
+
"title": "Core and Validation specifications meta-schema",
|
|
15
|
+
"allOf": [
|
|
16
|
+
{ "$ref": "meta/core" },
|
|
17
|
+
{ "$ref": "meta/applicator" },
|
|
18
|
+
{ "$ref": "meta/unevaluated" },
|
|
19
|
+
{ "$ref": "meta/validation" },
|
|
20
|
+
{ "$ref": "meta/meta-data" },
|
|
21
|
+
{ "$ref": "meta/format-annotation" },
|
|
22
|
+
{ "$ref": "meta/content" }
|
|
23
|
+
],
|
|
24
|
+
"type": ["object", "boolean"],
|
|
25
|
+
"$comment": "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",
|
|
26
|
+
"properties": {
|
|
27
|
+
"definitions": {
|
|
28
|
+
"$comment": "\"definitions\" has been replaced by \"$defs\".",
|
|
29
|
+
"type": "object",
|
|
30
|
+
"additionalProperties": { "$dynamicRef": "#meta" },
|
|
31
|
+
"deprecated": true,
|
|
32
|
+
"default": {}
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"$comment": "\"dependencies\" has been split and replaced by \"dependentSchemas\" and \"dependentRequired\" in order to serve their differing semantics.",
|
|
36
|
+
"type": "object",
|
|
37
|
+
"additionalProperties": {
|
|
38
|
+
"anyOf": [
|
|
39
|
+
{ "$dynamicRef": "#meta" },
|
|
40
|
+
{ "$ref": "meta/validation#/$defs/stringArray" }
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"deprecated": true,
|
|
44
|
+
"default": {}
|
|
45
|
+
},
|
|
46
|
+
"$recursiveAnchor": {
|
|
47
|
+
"$comment": "\"$recursiveAnchor\" has been replaced by \"$dynamicAnchor\".",
|
|
48
|
+
"$ref": "meta/core#/$defs/anchorString",
|
|
49
|
+
"deprecated": true
|
|
50
|
+
},
|
|
51
|
+
"$recursiveRef": {
|
|
52
|
+
"$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".",
|
|
53
|
+
"$ref": "meta/core#/$defs/uriReferenceString",
|
|
54
|
+
"deprecated": true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare const Errors: {
|
|
|
14
14
|
ARRAY_LENGTH_LONG: string;
|
|
15
15
|
ARRAY_UNIQUE: string;
|
|
16
16
|
ARRAY_ADDITIONAL_ITEMS: string;
|
|
17
|
+
ARRAY_UNEVALUATED_ITEMS: string;
|
|
17
18
|
MULTIPLE_OF: string;
|
|
18
19
|
MINIMUM: string;
|
|
19
20
|
MINIMUM_EXCLUSIVE: string;
|
|
@@ -23,6 +24,7 @@ export declare const Errors: {
|
|
|
23
24
|
OBJECT_PROPERTIES_MAXIMUM: string;
|
|
24
25
|
OBJECT_MISSING_REQUIRED_PROPERTY: string;
|
|
25
26
|
OBJECT_ADDITIONAL_PROPERTIES: string;
|
|
27
|
+
OBJECT_UNEVALUATED_PROPERTIES: string;
|
|
26
28
|
OBJECT_DEPENDENCY_KEY: string;
|
|
27
29
|
MIN_LENGTH: string;
|
|
28
30
|
MAX_LENGTH: string;
|
|
@@ -48,6 +50,8 @@ export declare const Errors: {
|
|
|
48
50
|
CONST: string;
|
|
49
51
|
CONTAINS: string;
|
|
50
52
|
PROPERTY_NAMES: string;
|
|
53
|
+
COLLECT_EVALUATED_DEPTH_EXCEEDED: string;
|
|
54
|
+
MAX_RECURSION_DEPTH_EXCEEDED: string;
|
|
51
55
|
};
|
|
52
56
|
export declare class ValidateError extends Error {
|
|
53
57
|
name: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ export { ValidateError } from './errors.js';
|
|
|
4
4
|
export type { FormatValidatorFn, FormatValidatorsOptions } from './format-validators.js';
|
|
5
5
|
export { getFormatValidators, getRegisteredFormats, getSupportedFormats, isFormatSupported, registerFormat, unregisterFormat, } from './format-validators.js';
|
|
6
6
|
export type { JsonSchemaType } from './json-schema.js';
|
|
7
|
-
export type {
|
|
7
|
+
export type { JsonSchemaCommon } from './json-schema.js';
|
|
8
|
+
export type { JsonSchema, JsonSchemaDraft4, JsonSchemaDraft6, JsonSchemaDraft7, JsonSchemaDraft201909, JsonSchemaDraft202012, JsonSchemaVersion, } from './json-schema-versions.js';
|
|
8
9
|
export type { Report, SchemaErrorDetail } from './report.js';
|
|
9
10
|
export type { ZSchema, ZSchemaAsync, ZSchemaAsyncSafe, ZSchemaSafe } from './z-schema.js';
|
|
10
11
|
export { ValidateOptions, ValidateResponse } from './z-schema-base.js';
|