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 ac60d16

Browse files
committed
Eliminate "child validation" language.
The "child validation" phrasing could be interpreted as indicating a separate validation process, which is incorrect. Removed all remaining references to "child validation". Removed superfluous paragraphs about primitive value validation always succeeding (left over from the approach taken in Draft 04). Removed the general considerations section about primitive vs child validation, as it is made clear by grouping keywords into sections and describing the behavior of each section. Moved description of type-specific validation behavior to each type-specific section, and removed the general considerations section about that behavior.
1 parent 301e771 commit ac60d16

File tree

1 file changed

+46
-81
lines changed

1 file changed

+46
-81
lines changed

‎jsonschema-validation.xml

Lines changed: 46 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -159,31 +159,6 @@
159159

160160
<section title="General validation considerations">
161161

162-
<section title="Keywords and instance primitive types">
163-
<t>
164-
Most validation keywords only constrain values within a certain primitive type.
165-
When the type of the instance is not of the type targeted by the keyword, the
166-
validation succeeds.
167-
</t>
168-
<t>
169-
For example, the "maxLength" keyword will only restrict certain strings (that are too long) from being valid.
170-
If the instance is a number, boolean, null, array, or object, the keyword passes validation.
171-
</t>
172-
</section>
173-
174-
<section title="Validation of primitive types and child values">
175-
<t>
176-
Two of the primitive types, array and object, allow for child values.
177-
The validation of the primitive type is considered separately from
178-
the validation of child instances.
179-
</t>
180-
<t>
181-
Note that while array elements are validated by at most one
182-
subschema, object property values may be validated by several
183-
subschemas from "properties" and "patternProperties".
184-
</t>
185-
</section>
186-
187162
<section title="Constraints and missing keywords">
188163
<t>
189164
Each JSON Schema validation keyword adds constraints that
@@ -227,6 +202,11 @@
227202
</t>
228203

229204
<section title="Validation keywords for numeric instances (number and integer)">
205+
<t>
206+
These keywords apply only to numbers (including integers).
207+
Validation of other types against these keywords always succeeds.
208+
</t>
209+
230210
<section title="multipleOf">
231211
<t>
232212
The value of "multipleOf" MUST be a number, strictly greater than 0.
@@ -274,6 +254,10 @@
274254
</section>
275255

276256
<section title="Validation keywords for strings">
257+
<t>
258+
These keywords apply only to strings. Validation
259+
of other types against these keywords always succeeds.
260+
</t>
277261

278262
<section title="maxLength">
279263
<t>
@@ -320,9 +304,11 @@
320304
</section>
321305
</section>
322306

323-
<section title="Validation keywords for arrays as primitive types">
307+
<section title="Validation keywords for arrays">
324308
<t>
325-
These keywords validate characteristics of arrays independent of their contents.
309+
These keywords validate characteristics of arrays as a whole,
310+
rather than validating specific array elements.
311+
Validation of other instance types against these keywords always succeeds.
326312
</t>
327313

328314
<section title="maxItems">
@@ -347,22 +333,7 @@
347333
Omitting this keyword has the same behavior as a value of 0.
348334
</t>
349335
</section>
350-
</section>
351336

352-
<section title="Validation keywords for array contents">
353-
<t>
354-
These keywords validate conditions, specifically existence and uniqueness, across all array contents.
355-
</t>
356-
<section title="contains">
357-
<t>
358-
The value of this keyword MUST be an object. This object MUST be
359-
a valid JSON Schema.
360-
</t>
361-
<t>
362-
An array instance is valid against "contains" if at least one of
363-
its elements is valid against the given schema.
364-
</t>
365-
</section>
366337
<section title="uniqueItems">
367338
<t>
368339
The value of this keyword MUST be a boolean.
@@ -376,26 +347,34 @@
376347
Omitting this keyword has the same behavior as a value of false.
377348
</t>
378349
</section>
350+
351+
<section title="contains">
352+
<t>
353+
The value of this keyword MUST be an object. This object MUST be
354+
a valid JSON Schema.
355+
</t>
356+
<t>
357+
An array instance is valid against "contains" if at least one of
358+
its elements is valid against the given schema.
359+
</t>
360+
</section>
379361
</section>
380362

381363
<section title="Validating array elements with subschemas">
382364
<t>
383365
These keywords determine which subschemas apply to each element of an array.
366+
Validation of other instance types against these keywords always succeeds.
384367
</t>
385368
<section title="items">
386369
<t>
387370
The value of "items" MUST be either a valid JSON Schema or an array of valid JSON Schemas.
388371
</t>
389372
<t>
390-
This keyword determines how child instances validate for arrays,
391-
and does not directly validate the immediate instance itself.
392-
</t>
393-
<t>
394-
If "items" is a schema, child validation succeeds if all elements
373+
If "items" is a schema, validation succeeds if all elements
395374
in the array successfully validate against that schema.
396375
</t>
397376
<t>
398-
If "items" is an array of schemas, child validation succeeds if
377+
If "items" is an array of schemas, validation succeeds if
399378
each element of the instance validates against the schema at the
400379
same position, if any.
401380
</t>
@@ -409,28 +388,27 @@
409388
The value of "additionalItems" MUST be a valid JSON Schema.
410389
</t>
411390
<t>
412-
This keyword determines how child instances validate for arrays,
413-
and does not directly validate the immediate instance itself.
414-
</t>
415-
<t>
416-
If "items" is an array of schemas, child validation succeeds
417-
if every instance element at a position greater than the size
418-
of "items" validates against "additionalItems".
391+
If "items" is an array of schemas, validation against
392+
"additionalItems" succeeds if every instance element at
393+
a position greater than the size of "items" validates
394+
against the "additionalItems" schema.
419395
</t>
420396
<t>
421397
Otherwise, "additionalItems" MUST be ignored, as the "items"
422-
schema (possibly the default value of an empty schema) is
423-
applied to all elements.
398+
schema is applied to all elements. Since omitting "items"
399+
has the same behavior as an empty "items" schema, "additonalItems"
400+
MUST be ignored if "items" is omitted.
424401
</t>
425402
<t>
426403
Omitting this keyword has the same behavior as an empty schema.
427404
</t>
428405
</section>
429406
</section>
430407

431-
<section title="Validation keywords for objects as primitive types">
408+
<section title="Validation keywords for objects">
432409
<t>
433410
These keywords validate characteristics of objects independent of the values of their properties.
411+
Validation of other instance types against these keywords always succeeds.
434412
</t>
435413

436414
<section title="maxProperties">
@@ -490,6 +468,7 @@
490468
<section title="Validating object properties with subschemas">
491469
<t>
492470
These keywords determine which subschemas apply to each property of an object.
471+
Validation of other instance types against these keywords always succeeds.
493472
</t>
494473

495474
<section title="properties">
@@ -498,11 +477,7 @@
498477
Each value of this object MUST be a valid JSON Schema.
499478
</t>
500479
<t>
501-
This keyword determines how child instances validate for objects,
502-
and does not directly validate the immediate instance itself.
503-
</t>
504-
<t>
505-
Child validation succeeds if, for each name that appears in both
480+
Validation succeeds if, for each name that appears in both
506481
the instance and as a name within this keyword's value, the child
507482
instance for that name successfully validates against the
508483
corresponding schema.
@@ -520,13 +495,7 @@
520495
MUST be a valid JSON Schema.
521496
</t>
522497
<t>
523-
This keyword determines how child instances validate for objects,
524-
and does not directly validate the immediate instance itself.
525-
Validation of the primitive instance type against this keyword
526-
always succeeds.
527-
</t>
528-
<t>
529-
Child validation succeeds if, for each instance name that matches any
498+
Validation succeeds if, for each instance property name that matches any
530499
regular expressions that appear as a property name in this keyword's value,
531500
the child instance for that name successfully validates against each
532501
schema that corresponds to a matching regular expression.
@@ -541,17 +510,11 @@
541510
The value of "additionalProperties" MUST be a valid JSON Schema.
542511
</t>
543512
<t>
544-
This keyword determines how child instances validate for objects,
545-
and does not directly validate the immediate instance itself.
546-
</t>
547-
<t>
548-
Child validation with "additionalProperties" applies only to the child
549-
values of instance names that do not match any names in "properties",
550-
and do not match any regular expression in "patternProperties".
551-
</t>
552-
<t>
553-
For all such properties, child validation succeeds if the child instance
554-
validates against the "additionalProperties" schema.
513+
Validation succeeds if, for each instance property name
514+
that does not match any names in "properties",
515+
and does not match any regular expression in "patternProperties",
516+
the child instance for that name successfully validates against
517+
the "additionalProperties" schema.
555518
</t>
556519
<t>
557520
Omitting this keyword has the same behavior as an empty schema.
@@ -564,6 +527,8 @@
564527
<t>
565528
This keyword specifies rules that are evaluated if the instance is an object and
566529
contains a certain property.
530+
Validation against instances of types other than object
531+
always succeeds.
567532
</t>
568533
<t>
569534
This keyword's value MUST be an object. Each property specifies a dependency.

0 commit comments

Comments
(0)

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