json-schema-library 7.4.5 → 7.4.6
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/dist/jsonSchemaLibrary.js +1 -1
- package/dist/module/lib/draft04/index.js +19 -9
- package/dist/module/lib/draft06/index.js +26 -14
- package/dist/module/lib/draft07/index.js +30 -18
- package/dist/module/lib/validate.js +1 -1
- package/lib/draft04/index.ts +19 -9
- package/lib/draft06/index.ts +26 -14
- package/lib/draft07/index.ts +30 -18
- package/lib/validate.ts +1 -1
- package/package.json +1 -1
- package/test-result-spec7.json +645 -645
|
@@ -21,52 +21,64 @@ import validate from "../validate";
|
|
|
21
21
|
import { Draft } from "../draft";
|
|
22
22
|
const draft07Config = {
|
|
23
23
|
typeKeywords: {
|
|
24
|
-
array: [
|
|
25
|
-
|
|
24
|
+
array: [
|
|
25
|
+
"allOf",
|
|
26
|
+
"anyOf",
|
|
27
|
+
"contains",
|
|
28
|
+
"enum",
|
|
29
|
+
"if",
|
|
30
|
+
"items",
|
|
31
|
+
"maxItems",
|
|
32
|
+
"minItems",
|
|
33
|
+
"not",
|
|
34
|
+
"oneOf",
|
|
35
|
+
"uniqueItems"
|
|
36
|
+
],
|
|
37
|
+
boolean: ["allOf", "anyOf", "enum", "not", "oneOf"],
|
|
26
38
|
object: [
|
|
27
39
|
"additionalProperties",
|
|
40
|
+
"allOf",
|
|
41
|
+
"anyOf",
|
|
28
42
|
"dependencies",
|
|
29
43
|
"enum",
|
|
30
44
|
"format",
|
|
31
|
-
"
|
|
45
|
+
"if",
|
|
32
46
|
"maxProperties",
|
|
47
|
+
"minProperties",
|
|
48
|
+
"not",
|
|
49
|
+
"oneOf",
|
|
33
50
|
"patternProperties",
|
|
34
51
|
"properties",
|
|
35
52
|
"propertyNames",
|
|
36
|
-
"required"
|
|
37
|
-
"not",
|
|
38
|
-
"oneOf",
|
|
39
|
-
"allOf",
|
|
40
|
-
"anyOf",
|
|
41
|
-
"if"
|
|
53
|
+
"required"
|
|
42
54
|
],
|
|
43
55
|
string: [
|
|
56
|
+
"allOf",
|
|
57
|
+
"anyOf",
|
|
44
58
|
"enum",
|
|
45
59
|
"format",
|
|
60
|
+
"if",
|
|
46
61
|
"maxLength",
|
|
47
62
|
"minLength",
|
|
48
|
-
"pattern",
|
|
49
63
|
"not",
|
|
50
64
|
"oneOf",
|
|
51
|
-
"
|
|
52
|
-
"anyOf",
|
|
53
|
-
"if"
|
|
65
|
+
"pattern"
|
|
54
66
|
],
|
|
55
67
|
number: [
|
|
68
|
+
"allOf",
|
|
69
|
+
"anyOf",
|
|
56
70
|
"enum",
|
|
57
71
|
"exclusiveMaximum",
|
|
58
72
|
"exclusiveMinimum",
|
|
59
73
|
"format",
|
|
74
|
+
"if",
|
|
60
75
|
"maximum",
|
|
61
76
|
"minimum",
|
|
62
77
|
"multipleOf",
|
|
63
78
|
"not",
|
|
64
|
-
"oneOf"
|
|
65
|
-
"allOf",
|
|
66
|
-
"anyOf",
|
|
67
|
-
"if"
|
|
79
|
+
"oneOf"
|
|
68
80
|
],
|
|
69
|
-
null: ["
|
|
81
|
+
null: ["allOf", "anyOf", "enum", "format", "not", "oneOf"]
|
|
70
82
|
},
|
|
71
83
|
validateKeyword: KEYWORDS,
|
|
72
84
|
validateType: TYPES,
|
|
@@ -23,7 +23,7 @@ function getJsonSchemaType(value, expectedType) {
|
|
|
23
23
|
*/
|
|
24
24
|
export default function validate(core, value, schema = core.rootSchema, pointer = "#") {
|
|
25
25
|
schema = core.resolveRef(schema);
|
|
26
|
-
//
|
|
26
|
+
// @draft >= 07
|
|
27
27
|
if (getTypeOf(schema) === "boolean") {
|
|
28
28
|
if (schema) {
|
|
29
29
|
return [];
|
package/lib/draft04/index.ts
CHANGED
|
@@ -23,8 +23,18 @@ import { JSONSchema } from "../types";
|
|
|
23
23
|
|
|
24
24
|
const draft04Config: DraftConfig = {
|
|
25
25
|
typeKeywords: {
|
|
26
|
-
array: [
|
|
27
|
-
|
|
26
|
+
array: [
|
|
27
|
+
"allOf",
|
|
28
|
+
"anyOf",
|
|
29
|
+
"enum",
|
|
30
|
+
"items",
|
|
31
|
+
"maxItems",
|
|
32
|
+
"minItems",
|
|
33
|
+
"not",
|
|
34
|
+
"oneOf",
|
|
35
|
+
"uniqueItems"
|
|
36
|
+
],
|
|
37
|
+
boolean: ["enum", "not", "allOf", "anyOf", "oneOf"],
|
|
28
38
|
object: [
|
|
29
39
|
"additionalProperties",
|
|
30
40
|
"dependencies",
|
|
@@ -41,28 +51,28 @@ const draft04Config: DraftConfig = {
|
|
|
41
51
|
"anyOf"
|
|
42
52
|
],
|
|
43
53
|
string: [
|
|
54
|
+
"allOf",
|
|
55
|
+
"anyOf",
|
|
44
56
|
"enum",
|
|
45
57
|
"format",
|
|
46
58
|
"maxLength",
|
|
47
59
|
"minLength",
|
|
48
|
-
"pattern",
|
|
49
60
|
"not",
|
|
50
61
|
"oneOf",
|
|
51
|
-
"
|
|
52
|
-
"anyOf"
|
|
62
|
+
"pattern"
|
|
53
63
|
],
|
|
54
64
|
number: [
|
|
65
|
+
"allOf",
|
|
66
|
+
"anyOf",
|
|
55
67
|
"enum",
|
|
56
68
|
"format",
|
|
57
69
|
"maximum",
|
|
58
70
|
"minimum",
|
|
59
71
|
"multipleOf",
|
|
60
72
|
"not",
|
|
61
|
-
"oneOf"
|
|
62
|
-
"allOf",
|
|
63
|
-
"anyOf"
|
|
73
|
+
"oneOf"
|
|
64
74
|
],
|
|
65
|
-
null: ["
|
|
75
|
+
null: ["allOf", "anyOf", "enum", "format", "not", "oneOf"]
|
|
66
76
|
},
|
|
67
77
|
validateKeyword: KEYWORDS,
|
|
68
78
|
validateType: TYPES,
|
package/lib/draft06/index.ts
CHANGED
|
@@ -23,36 +23,48 @@ import { JSONSchema } from "../types";
|
|
|
23
23
|
|
|
24
24
|
const draft06Config: DraftConfig = {
|
|
25
25
|
typeKeywords: {
|
|
26
|
-
array: [
|
|
27
|
-
|
|
26
|
+
array: [
|
|
27
|
+
"allOf",
|
|
28
|
+
"anyOf",
|
|
29
|
+
"contains",
|
|
30
|
+
"enum",
|
|
31
|
+
"if",
|
|
32
|
+
"items",
|
|
33
|
+
"maxItems",
|
|
34
|
+
"minItems",
|
|
35
|
+
"not",
|
|
36
|
+
"oneOf",
|
|
37
|
+
"uniqueItems"
|
|
38
|
+
],
|
|
39
|
+
boolean: ["allOf", "anyOf", "enum", "not", "oneOf"],
|
|
28
40
|
object: [
|
|
29
41
|
"additionalProperties",
|
|
42
|
+
"allOf",
|
|
43
|
+
"anyOf",
|
|
30
44
|
"dependencies",
|
|
31
45
|
"enum",
|
|
32
46
|
"format",
|
|
33
|
-
"
|
|
47
|
+
"if",
|
|
34
48
|
"maxProperties",
|
|
49
|
+
"minProperties",
|
|
50
|
+
"not",
|
|
51
|
+
"oneOf",
|
|
35
52
|
"patternProperties",
|
|
36
53
|
"properties",
|
|
37
54
|
"propertyNames",
|
|
38
|
-
"required"
|
|
39
|
-
"not",
|
|
40
|
-
"oneOf",
|
|
41
|
-
"allOf",
|
|
42
|
-
"anyOf",
|
|
43
|
-
"if"
|
|
55
|
+
"required"
|
|
44
56
|
],
|
|
45
57
|
string: [
|
|
58
|
+
"allOf",
|
|
59
|
+
"anyOf",
|
|
46
60
|
"enum",
|
|
47
61
|
"format",
|
|
62
|
+
"if",
|
|
48
63
|
"maxLength",
|
|
49
64
|
"minLength",
|
|
50
|
-
"pattern",
|
|
51
65
|
"not",
|
|
52
66
|
"oneOf",
|
|
53
|
-
"
|
|
54
|
-
"anyOf",
|
|
55
|
-
"if"
|
|
67
|
+
"pattern"
|
|
56
68
|
],
|
|
57
69
|
number: [
|
|
58
70
|
"enum",
|
|
@@ -68,7 +80,7 @@ const draft06Config: DraftConfig = {
|
|
|
68
80
|
"anyOf",
|
|
69
81
|
"if"
|
|
70
82
|
],
|
|
71
|
-
null: ["
|
|
83
|
+
null: ["allOf", "anyOf", "enum", "format", "not", "oneOf"]
|
|
72
84
|
},
|
|
73
85
|
validateKeyword: KEYWORDS,
|
|
74
86
|
validateType: TYPES,
|
package/lib/draft07/index.ts
CHANGED
|
@@ -23,52 +23,64 @@ import { JSONSchema } from "../types";
|
|
|
23
23
|
|
|
24
24
|
const draft07Config: DraftConfig = {
|
|
25
25
|
typeKeywords: {
|
|
26
|
-
array: [
|
|
27
|
-
|
|
26
|
+
array: [
|
|
27
|
+
"allOf",
|
|
28
|
+
"anyOf",
|
|
29
|
+
"contains",
|
|
30
|
+
"enum",
|
|
31
|
+
"if",
|
|
32
|
+
"items",
|
|
33
|
+
"maxItems",
|
|
34
|
+
"minItems",
|
|
35
|
+
"not",
|
|
36
|
+
"oneOf",
|
|
37
|
+
"uniqueItems"
|
|
38
|
+
],
|
|
39
|
+
boolean: ["allOf", "anyOf", "enum", "not", "oneOf"],
|
|
28
40
|
object: [
|
|
29
41
|
"additionalProperties",
|
|
42
|
+
"allOf",
|
|
43
|
+
"anyOf",
|
|
30
44
|
"dependencies",
|
|
31
45
|
"enum",
|
|
32
46
|
"format",
|
|
33
|
-
"
|
|
47
|
+
"if",
|
|
34
48
|
"maxProperties",
|
|
49
|
+
"minProperties",
|
|
50
|
+
"not",
|
|
51
|
+
"oneOf",
|
|
35
52
|
"patternProperties",
|
|
36
53
|
"properties",
|
|
37
54
|
"propertyNames",
|
|
38
|
-
"required"
|
|
39
|
-
"not",
|
|
40
|
-
"oneOf",
|
|
41
|
-
"allOf",
|
|
42
|
-
"anyOf",
|
|
43
|
-
"if"
|
|
55
|
+
"required"
|
|
44
56
|
],
|
|
45
57
|
string: [
|
|
58
|
+
"allOf",
|
|
59
|
+
"anyOf",
|
|
46
60
|
"enum",
|
|
47
61
|
"format",
|
|
62
|
+
"if",
|
|
48
63
|
"maxLength",
|
|
49
64
|
"minLength",
|
|
50
|
-
"pattern",
|
|
51
65
|
"not",
|
|
52
66
|
"oneOf",
|
|
53
|
-
"
|
|
54
|
-
"anyOf",
|
|
55
|
-
"if"
|
|
67
|
+
"pattern"
|
|
56
68
|
],
|
|
57
69
|
number: [
|
|
70
|
+
"allOf",
|
|
71
|
+
"anyOf",
|
|
58
72
|
"enum",
|
|
59
73
|
"exclusiveMaximum",
|
|
60
74
|
"exclusiveMinimum",
|
|
61
75
|
"format",
|
|
76
|
+
"if",
|
|
62
77
|
"maximum",
|
|
63
78
|
"minimum",
|
|
64
79
|
"multipleOf",
|
|
65
80
|
"not",
|
|
66
|
-
"oneOf"
|
|
67
|
-
"allOf",
|
|
68
|
-
"anyOf",
|
|
69
|
-
"if"
|
|
81
|
+
"oneOf"
|
|
70
82
|
],
|
|
71
|
-
null: ["
|
|
83
|
+
null: ["allOf", "anyOf", "enum", "format", "not", "oneOf"]
|
|
72
84
|
},
|
|
73
85
|
validateKeyword: KEYWORDS,
|
|
74
86
|
validateType: TYPES,
|
package/lib/validate.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-schema-library",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.6",
|
|
4
4
|
"description": "Customizable and hackable json-validator and json-schema utilities for traversal, data generation and validation",
|
|
5
5
|
"module": "dist/module/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|