Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 356af3b

Browse files
Merge pull request #111 from handrews/childv
Make properties/items wording consistent.
2 parents df8d370 + a0979f3 commit 356af3b

File tree

1 file changed

+73
-25
lines changed

1 file changed

+73
-25
lines changed

‎jsonschema-validation.xml‎

Lines changed: 73 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,20 @@
168168
</t>
169169
</section>
170170

171+
<section title="Validation of primitive types and child values">
172+
<t>
173+
Two of the primitive types, array and object, allow for child values. The validation of
174+
the primitive type is considered separately from the validation of child instances.
175+
</t>
176+
<t>
177+
For arrays, primitive type validation consists of validating restrictions on length.
178+
</t>
179+
<t>
180+
For objects, primitive type validation consists of validating restrictions on the presence
181+
or absence of property names.
182+
</t>
183+
</section>
184+
171185
<section title="Missing keywords">
172186
<t>
173187
Validation keywords that are missing never restrict validation.
@@ -297,32 +311,45 @@
297311
</t>
298312
</section>
299313

300-
<section title="additionalItems and items">
314+
<section title="items">
301315
<t>
302-
The value of "additionalItems" MUST be either a boolean or an object. If
303-
it is an object, this object MUST be a valid JSON Schema.
316+
The value of "items" MUST be either an object or an array of objects.
317+
Each object MUST be a valid JSON Schema.
304318
</t>
305319
<t>
306-
The value of "items" MUST be either a schema or array of schemas.
320+
If absent, it can be considered present with an empty schema.
307321
</t>
308322
<t>
309-
Successful validation of an array instance with regards to these two
310-
keywords is determined as follows:
323+
This keyword controls child instance validation. Validation of the
324+
primitive instance type against this keyword always succeeds.
325+
</t>
326+
<t>
327+
If "items" is a schema, child validation succeeds if all elements
328+
in the array successfully validate against that schema.
329+
</t>
330+
<t>
331+
If "items" is an array of schemas, child validation succeeds if
332+
each element of the instance validates against the schema at the
333+
same position, if any.
334+
</t>
335+
</section>
311336

312-
<list>
313-
<t>if "items" is not present, or its value is an object, validation
314-
of the instance always succeeds, regardless of the value of
315-
"additionalItems";</t>
316-
<t>if the value of "additionalItems" is boolean value true or an
317-
object, validation of the instance always succeeds;</t>
318-
<t>if the value of "additionalItems" is boolean value false and the
319-
value of "items" is an array, the instance is valid if
320-
its size is less than, or equal to, the size of "items".</t>
321-
</list>
337+
<section title="additionalItems">
338+
<t>
339+
The value of "additionalItems" MUST be a boolean or an object.
340+
If it is an object, the object MUST be a valid JSON Schema.
341+
</t>
342+
<t>
343+
If absent, it can be considered present with an empty schema.
322344
</t>
323345
<t>
324-
If either keyword is absent, it may be considered present with an empty
325-
schema.
346+
This keyword controls child instance validation. Validation of the
347+
primitive instance type against this keyword always succeeds.
348+
</t>
349+
<t>
350+
If "items" is an array of schemas, child validation succeeds
351+
if every instance element at a position greater than the size
352+
of "items" validates against "additionalItems".
326353
</t>
327354
</section>
328355

@@ -415,6 +442,15 @@
415442
<t>
416443
If absent, it can be considered the same as an empty object.
417444
</t>
445+
<t>
446+
This keyword controls child instance validation. Validation of the
447+
primitive instance type against this keyword always succeeds.
448+
</t>
449+
<t>
450+
Child validation succeeds if, for each name that appears in both
451+
the instance and as a name within this keyword's value, the instance
452+
value successfully validates against the corresponding schema.
453+
</t>
418454
</section>
419455

420456
<section title="patternProperties">
@@ -427,27 +463,39 @@
427463
<t>
428464
If absent, it can be considered the same as an empty object.
429465
</t>
466+
<t>
467+
This keyword controls child instance validation. Validation of the
468+
primitive instance type against this keyword always succeeds.
469+
</t>
470+
<t>
471+
Child validation succeeds if, for each instance name that matches any
472+
regular expressions that appear as a property name in this keyword's value,
473+
the child instance for that name successfully validates against each
474+
schema that corresponds to a matching regular expression.
475+
</t>
430476
</section>
431477

432478
<section title="additionalProperties">
433479
<t>
434-
The value of "additionalProperties" MUST be a boolean or a schema.
480+
The value of "additionalProperties" MUST be a boolean or an
481+
object. If it is an object, the object MUST be a valid JSON Schema.
435482
</t>
436483
<t>
437484
If "additionalProperties" is absent, it may be considered present with
438485
an empty schema as a value.
439486
</t>
440487
<t>
441-
If "additionalProperties" is true, validation always succeeds.
488+
This keyword controls child instance validation. Validation of the
489+
primitive instance type against this keyword always succeeds.
442490
</t>
443491
<t>
444-
If "additionalProperties" is false, validation succeeds only if the instance
445-
is an object and all properties on the instance were covered by "properties"
446-
and/or "patternProperties".
492+
Child validation with "additionalProperties" applies only to the child
493+
values of instance names that do not match any names in "properties",
494+
and do not match any regular expression in "patternProperties".
447495
</t>
448496
<t>
449-
If "additionalProperties" is an object, validate the value as a schema to all
450-
of the properties that weren't validated by "properties" nor "patternProperties".
497+
For all such properties, child validation succeeds if the child instance
498+
validates agains the "additionalProperties" schema.
451499
</t>
452500
</section>
453501

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /