Skip to content

Commit d2ba534

Browse files
committed
Add option to also validate the schema (jsonrainbow#357)
1 parent cabc3fa commit d2ba534

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+828
-14
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ third argument to `Validator::validate()`, or can be provided as the third argum
190190
| `Constraint::CHECK_MODE_ONLY_REQUIRED_DEFAULTS` | When applying defaults, only set values that are required |
191191
| `Constraint::CHECK_MODE_EXCEPTIONS` | Throw an exception immediately if validation fails |
192192
| `Constraint::CHECK_MODE_DISABLE_FORMAT` | Do not validate "format" constraints |
193+
| `Constraint::CHECK_MODE_VALIDATE_SCHEMA` | Validate the schema as well as the provided document |
193194

194195
Please note that using `Constraint::CHECK_MODE_COERCE_TYPES` or `Constraint::CHECK_MODE_APPLY_DEFAULTS`
195196
will modify your original data.
+193
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-03/schema#",
3+
"id": "http://json-schema.org/draft-03/schema#",
4+
"type": "object",
5+
"properties": {
6+
"type": {
7+
"type": [
8+
"string",
9+
"array"
10+
],
11+
"items": {
12+
"type": [
13+
"string",
14+
{
15+
"$ref": "#"
16+
}
17+
]
18+
},
19+
"uniqueItems": true,
20+
"default": "any"
21+
},
22+
"properties": {
23+
"type": "object",
24+
"additionalProperties": {
25+
"$ref": "#"
26+
},
27+
"default": {}
28+
},
29+
"patternProperties": {
30+
"type": "object",
31+
"additionalProperties": {
32+
"$ref": "#"
33+
},
34+
"default": {}
35+
},
36+
"additionalProperties": {
37+
"type": [
38+
{
39+
"$ref": "#"
40+
},
41+
"boolean"
42+
],
43+
"default": {}
44+
},
45+
"items": {
46+
"type": [
47+
{
48+
"$ref": "#"
49+
},
50+
"array"
51+
],
52+
"items": {
53+
"$ref": "#"
54+
},
55+
"default": {}
56+
},
57+
"additionalItems": {
58+
"type": [
59+
{
60+
"$ref": "#"
61+
},
62+
"boolean"
63+
],
64+
"default": {}
65+
},
66+
"required": {
67+
"type": "boolean",
68+
"default": false
69+
},
70+
"dependencies": {
71+
"type": "object",
72+
"additionalProperties": {
73+
"type": [
74+
"string",
75+
"array",
76+
{
77+
"$ref": "#"
78+
}
79+
],
80+
"items": {
81+
"type": "string"
82+
}
83+
},
84+
"default": {}
85+
},
86+
"minimum": {
87+
"type": "number"
88+
},
89+
"maximum": {
90+
"type": "number"
91+
},
92+
"exclusiveMinimum": {
93+
"type": "boolean",
94+
"default": false
95+
},
96+
"exclusiveMaximum": {
97+
"type": "boolean",
98+
"default": false
99+
},
100+
"minItems": {
101+
"type": "integer",
102+
"minimum": 0,
103+
"default": 0
104+
},
105+
"maxItems": {
106+
"type": "integer",
107+
"minimum": 0
108+
},
109+
"uniqueItems": {
110+
"type": "boolean",
111+
"default": false
112+
},
113+
"pattern": {
114+
"type": "string",
115+
"format": "regex"
116+
},
117+
"minLength": {
118+
"type": "integer",
119+
"minimum": 0,
120+
"default": 0
121+
},
122+
"maxLength": {
123+
"type": "integer"
124+
},
125+
"enum": {
126+
"type": "array",
127+
"minItems": 1,
128+
"uniqueItems": true
129+
},
130+
"default": {
131+
"type": "any"
132+
},
133+
"title": {
134+
"type": "string"
135+
},
136+
"description": {
137+
"type": "string"
138+
},
139+
"format": {
140+
"type": "string"
141+
},
142+
"divisibleBy": {
143+
"type": "number",
144+
"minimum": 0,
145+
"exclusiveMinimum": true,
146+
"default": 1
147+
},
148+
"disallow": {
149+
"type": [
150+
"string",
151+
"array"
152+
],
153+
"items": {
154+
"type": [
155+
"string",
156+
{
157+
"$ref": "#"
158+
}
159+
]
160+
},
161+
"uniqueItems": true
162+
},
163+
"extends": {
164+
"type": [
165+
{
166+
"$ref": "#"
167+
},
168+
"array"
169+
],
170+
"items": {
171+
"$ref": "#"
172+
},
173+
"default": {}
174+
},
175+
"id": {
176+
"type": "string",
177+
"format": "uri"
178+
},
179+
"$ref": {
180+
"type": "string",
181+
"format": "uri"
182+
},
183+
"$schema": {
184+
"type": "string",
185+
"format": "uri"
186+
}
187+
},
188+
"dependencies": {
189+
"exclusiveMinimum": "minimum",
190+
"exclusiveMaximum": "maximum"
191+
},
192+
"default": {}
193+
}

0 commit comments

Comments
 (0)