|
342 | 342 | results. They should not define additional constraints independent
|
343 | 343 | of their subschemas.
|
344 | 344 | </t>
|
| 345 | + <t> |
| 346 | + Keywords within the same schema object are referred to as adjacent keywords. |
| 347 | + </t> |
345 | 348 | <t>
|
346 | 349 | Extension keywords, meaning those defined outside of this document
|
347 | 350 | and its companions, are free to define other behaviors as well.
|
|
680 | 683 | <section title="Keyword Interactions">
|
681 | 684 | <t>
|
682 | 685 | Keyword behavior MAY be defined in terms of the annotation results
|
683 |
| - of <xref target="root">subschemas</xref> and/or adjacent keywords. |
| 686 | + of <xref target="root">subschemas</xref> and/or adjacent keywords |
| 687 | + (keywords within the same schema object) and their subschemas. |
684 | 688 | Such keywords MUST NOT result in a circular dependency.
|
685 | 689 | Keywords MAY modify their behavior based on the presence or absence
|
686 | 690 | of another keyword in the same
|
|
706 | 710 | <t>
|
707 | 711 | Because annotation collection can add significant cost in terms of both
|
708 | 712 | computation and memory, implementations MAY opt out of this feature.
|
709 |
| - Keywords known to an implementation to have assertion or applicator behavior |
710 |
| - that depend on annotation results MUST then be treated as errors, unless |
711 |
| - an alternate implementation producing the same behavior is available. |
712 |
| - Keywords of this sort SHOULD describe reasonable alternate approaches |
713 |
| - when appropriate. This approach is demonstrated by the |
| 713 | + Keywords that are specified in terms of collected annotations SHOULD |
| 714 | + describe reasonable alternate approaches when appropriate. |
| 715 | + This approach is demonstrated by the |
714 | 716 | "<xref target="items" format="title"/>" and
|
715 | 717 | "<xref target="additionalProperties" format="title"/>" keywords in this
|
716 | 718 | document.
|
717 | 719 | </t>
|
| 720 | + <t> |
| 721 | + Note that when no such alternate approach is possible for a keyword, |
| 722 | + implementations that do not support annotation collections will not |
| 723 | + be able to support those keywords or vocabularies that contain them. |
| 724 | + </t> |
718 | 725 | </section>
|
719 | 726 | <section title="Identifiers" anchor="identifiers">
|
720 | 727 | <t>
|
|
2357 | 2364 | </t>
|
2358 | 2365 | </section>
|
2359 | 2366 |
|
2360 |
| - <section title="unevaluatedItems" anchor="unevaluatedItems"> |
2361 |
| - <t> |
2362 |
| - The value of "unevaluatedItems" MUST be a valid JSON Schema. |
2363 |
| - </t> |
2364 |
| - <t> |
2365 |
| - The behavior of this keyword depends on the annotation results of |
2366 |
| - adjacent keywords that apply to the instance location being validated. |
2367 |
| - Specifically, the annotations from "prefixItems", "items", and "contains", |
2368 |
| - which can come from those keywords when they are adjacent to the |
2369 |
| - "unevaluatedItems" keyword. Those two annotations, as well as |
2370 |
| - "unevaluatedItems", can also result from any and all adjacent |
2371 |
| - <xref target="in-place">in-place applicator</xref> keywords. |
2372 |
| - This includes but is not limited to the in-place applicators |
2373 |
| - defined in this document. |
2374 |
| - </t> |
2375 |
| - <t> |
2376 |
| - If no relevant annotations are present, the "unevaluatedItems" |
2377 |
| - subschema MUST be applied to all locations in the array. |
2378 |
| - If a boolean true value is present from any of the relevant annotations, |
2379 |
| - "unevaluatedItems" MUST be ignored. Otherwise, the subschema |
2380 |
| - MUST be applied to any index greater than the largest annotation |
2381 |
| - value for "prefixItems", which does not appear in any annotation |
2382 |
| - value for "contains". |
2383 |
| - </t> |
2384 |
| - <t> |
2385 |
| - This means that "prefixItems", "items", "contains", and all in-place |
2386 |
| - applicators MUST be evaluated before this keyword can be evaluated. |
2387 |
| - Authors of extension keywords MUST NOT define an in-place applicator |
2388 |
| - that would need to be evaluated before this keyword. |
2389 |
| - </t> |
2390 |
| - <t> |
2391 |
| - If the "unevaluatedItems" subschema is applied to any |
2392 |
| - positions within the instance array, it produces an |
2393 |
| - annotation result of boolean true, analogous to the |
2394 |
| - behavior of "items". |
2395 |
| - </t> |
2396 |
| - <t> |
2397 |
| - Omitting this keyword has the same assertion behavior as |
2398 |
| - an empty schema. |
2399 |
| - </t> |
2400 |
| - <t> |
2401 |
| - Implementations that do not collect annotations MUST raise an error |
2402 |
| - upon encountering this keyword. |
2403 |
| - </t> |
2404 |
| - </section> |
2405 |
| - |
2406 | 2367 | <section title="contains">
|
2407 | 2368 | <t>
|
2408 | 2369 | The value of this keyword MUST be a valid JSON Schema.
|
|
2510 | 2471 | </t>
|
2511 | 2472 | </section>
|
2512 | 2473 |
|
2513 |
| - <section title="unevaluatedProperties" anchor="unevaluatedProperties"> |
2514 |
| - <t> |
2515 |
| - The value of "unevaluatedProperties" MUST be a valid JSON Schema. |
2516 |
| - </t> |
2517 |
| - <t> |
2518 |
| - The behavior of this keyword depends on the annotation results of |
2519 |
| - adjacent keywords that apply to the instance location being validated. |
2520 |
| - Specifically, the annotations from "properties", "patternProperties", |
2521 |
| - and "additionalProperties", which can come from those keywords when |
2522 |
| - they are adjacent to the "unevaluatedProperties" keyword. Those |
2523 |
| - three annotations, as well as "unevaluatedProperties", can also |
2524 |
| - result from any and all adjacent |
2525 |
| - <xref target="in-place">in-place applicator</xref> keywords. |
2526 |
| - This includes but is not limited to the in-place applicators |
2527 |
| - defined in this document. |
2528 |
| - </t> |
2529 |
| - <t> |
2530 |
| - Validation with "unevaluatedProperties" applies only to the child |
2531 |
| - values of instance names that do not appear in the "properties", |
2532 |
| - "patternProperties", "additionalProperties", or |
2533 |
| - "unevaluatedProperties" annotation results that apply to the |
2534 |
| - instance location being validated. |
2535 |
| - </t> |
2536 |
| - <t> |
2537 |
| - For all such properties, validation succeeds if the child instance |
2538 |
| - validates against the "unevaluatedProperties" schema. |
2539 |
| - </t> |
2540 |
| - <t> |
2541 |
| - This means that "properties", "patternProperties", "additionalProperties", |
2542 |
| - and all in-place applicators MUST be evaluated before this keyword can |
2543 |
| - be evaluated. Authors of extension keywords MUST NOT define an in-place |
2544 |
| - applicator that would need to be evaluated before this keyword. |
2545 |
| - </t> |
2546 |
| - <t> |
2547 |
| - The annotation result of this keyword is the set of instance |
2548 |
| - property names validated by this keyword's subschema. |
2549 |
| - Annotation results for "unevaluatedProperties" keywords from |
2550 |
| - multiple schemas applied to the same instance location are combined |
2551 |
| - by taking the union of the sets. |
2552 |
| - </t> |
2553 |
| - <t> |
2554 |
| - Omitting this keyword has the same assertion behavior as |
2555 |
| - an empty schema. |
2556 |
| - </t> |
2557 |
| - <t> |
2558 |
| - Implementations that do not collect annotations MUST raise an error |
2559 |
| - upon encountering this keyword. |
2560 |
| - </t> |
2561 |
| - </section> |
2562 |
| - |
2563 | 2474 | <section title="propertyNames">
|
2564 | 2475 | <t>
|
2565 | 2476 | The value of "propertyNames" MUST be a valid JSON Schema.
|
|
2577 | 2488 | </section>
|
2578 | 2489 | </section>
|
2579 | 2490 |
|
| 2491 | + <section title="A Vocabulary for Unevaluated Locations"> |
| 2492 | + <t> |
| 2493 | + The purpose of these keywords is to enable schema authors to apply |
| 2494 | + subschemas to array items or object properties that have not been |
| 2495 | + successfully evaluated against any dynamic-scope subschema of any |
| 2496 | + adjacent keywords. |
| 2497 | + </t> |
| 2498 | + <t> |
| 2499 | + These instance items or properties may have been unsuccessfully evaluated |
| 2500 | + against one or more adjacent keyword subschemas, such as when an assertion |
| 2501 | + in a branch of an "anyOf" fails. Such failed evaluations are not considered |
| 2502 | + to contribute to whether or not the item or property has been evaluated. |
| 2503 | + Only successful evaluations are considered. |
| 2504 | + </t> |
| 2505 | + <t> |
| 2506 | + Recall that adjacent keywords are keywords within the same schema object, |
| 2507 | + and that the dynamic-scope subschemas include reference targets as well as |
| 2508 | + lexical subschemas. |
| 2509 | + </t> |
| 2510 | + <t> |
| 2511 | + The behavior of these keywords depend on the annotation results of |
| 2512 | + adjacent keywords that apply to the instance location being validated. |
| 2513 | + </t> |
| 2514 | + <t> |
| 2515 | + Meta-schemas that do not use "$vocabulary" SHOULD be considered to |
| 2516 | + require this vocabulary as if its URI were present with a value of true. |
| 2517 | + </t> |
| 2518 | + <t> |
| 2519 | + The current URI for this vocabulary, known as the Unevaluated Applicator |
| 2520 | + vocabulary, is: |
| 2521 | + <https://json-schema.org/draft/2019-09/vocab/unevaluated>. |
| 2522 | + </t> |
| 2523 | + <t> |
| 2524 | + The current URI for the corresponding meta-schema is: |
| 2525 | + <eref target="https://json-schema.org/draft/2019-09/meta/unevaluated"/>. |
| 2526 | + </t> |
| 2527 | + <t> |
| 2528 | + Updated vocabulary and meta-schema URIs MAY be published between |
| 2529 | + specification drafts in order to correct errors. Implementations |
| 2530 | + SHOULD consider URIs dated after this specification draft and |
| 2531 | + before the next to indicate the same syntax and semantics |
| 2532 | + as those listed here. |
| 2533 | + </t> |
| 2534 | + <section title="unevaluatedItems" anchor="unevaluatedItems"> |
| 2535 | + <t> |
| 2536 | + The value of "unevaluatedItems" MUST be a valid JSON Schema. |
| 2537 | + </t> |
| 2538 | + <t> |
| 2539 | + The behavior of this keyword depends on the annotation results of |
| 2540 | + adjacent keywords that apply to the instance location being validated. |
| 2541 | + Specifically, the annotations from "prefixItems", "items", and "contains", |
| 2542 | + which can come from those keywords when they are adjacent to the |
| 2543 | + "unevaluatedItems" keyword. Those two annotations, as well as |
| 2544 | + "unevaluatedItems", can also result from any and all adjacent |
| 2545 | + <xref target="in-place">in-place applicator</xref> keywords. |
| 2546 | + This includes but is not limited to the in-place applicators |
| 2547 | + defined in this document. |
| 2548 | + </t> |
| 2549 | + <t> |
| 2550 | + If no relevant annotations are present, the "unevaluatedItems" |
| 2551 | + subschema MUST be applied to all locations in the array. |
| 2552 | + If a boolean true value is present from any of the relevant annotations, |
| 2553 | + "unevaluatedItems" MUST be ignored. Otherwise, the subschema |
| 2554 | + MUST be applied to any index greater than the largest annotation |
| 2555 | + value for "prefixItems", which does not appear in any annotation |
| 2556 | + value for "contains". |
| 2557 | + </t> |
| 2558 | + <t> |
| 2559 | + This means that "prefixItems", "items", "contains", and all in-place |
| 2560 | + applicators MUST be evaluated before this keyword can be evaluated. |
| 2561 | + Authors of extension keywords MUST NOT define an in-place applicator |
| 2562 | + that would need to be evaluated before this keyword. |
| 2563 | + </t> |
| 2564 | + <t> |
| 2565 | + If the "unevaluatedItems" subschema is applied to any |
| 2566 | + positions within the instance array, it produces an |
| 2567 | + annotation result of boolean true, analogous to the |
| 2568 | + behavior of "items". |
| 2569 | + </t> |
| 2570 | + <t> |
| 2571 | + Omitting this keyword has the same assertion behavior as |
| 2572 | + an empty schema. |
| 2573 | + </t> |
| 2574 | + </section> |
| 2575 | + |
| 2576 | + <section title="unevaluatedProperties" anchor="unevaluatedProperties"> |
| 2577 | + <t> |
| 2578 | + The value of "unevaluatedProperties" MUST be a valid JSON Schema. |
| 2579 | + </t> |
| 2580 | + <t> |
| 2581 | + The behavior of this keyword depends on the annotation results of |
| 2582 | + adjacent keywords that apply to the instance location being validated. |
| 2583 | + Specifically, the annotations from "properties", "patternProperties", |
| 2584 | + and "additionalProperties", which can come from those keywords when |
| 2585 | + they are adjacent to the "unevaluatedProperties" keyword. Those |
| 2586 | + three annotations, as well as "unevaluatedProperties", can also |
| 2587 | + result from any and all adjacent |
| 2588 | + <xref target="in-place">in-place applicator</xref> keywords. |
| 2589 | + This includes but is not limited to the in-place applicators |
| 2590 | + defined in this document. |
| 2591 | + </t> |
| 2592 | + <t> |
| 2593 | + Validation with "unevaluatedProperties" applies only to the child |
| 2594 | + values of instance names that do not appear in the "properties", |
| 2595 | + "patternProperties", "additionalProperties", or |
| 2596 | + "unevaluatedProperties" annotation results that apply to the |
| 2597 | + instance location being validated. |
| 2598 | + </t> |
| 2599 | + <t> |
| 2600 | + For all such properties, validation succeeds if the child instance |
| 2601 | + validates against the "unevaluatedProperties" schema. |
| 2602 | + </t> |
| 2603 | + <t> |
| 2604 | + This means that "properties", "patternProperties", "additionalProperties", |
| 2605 | + and all in-place applicators MUST be evaluated before this keyword can |
| 2606 | + be evaluated. Authors of extension keywords MUST NOT define an in-place |
| 2607 | + applicator that would need to be evaluated before this keyword. |
| 2608 | + </t> |
| 2609 | + <t> |
| 2610 | + The annotation result of this keyword is the set of instance |
| 2611 | + property names validated by this keyword's subschema. |
| 2612 | + Annotation results for "unevaluatedProperties" keywords from |
| 2613 | + multiple schemas applied to the same instance location are combined |
| 2614 | + by taking the union of the sets. |
| 2615 | + </t> |
| 2616 | + <t> |
| 2617 | + Omitting this keyword has the same assertion behavior as |
| 2618 | + an empty schema. |
| 2619 | + </t> |
| 2620 | + </section> |
| 2621 | + </section> |
| 2622 | + |
2580 | 2623 | <section title="Output Formatting" anchor="output">
|
2581 | 2624 | <t>
|
2582 | 2625 | JSON Schema is defined to be platform-independent. As such, to increase compatibility
|
|
0 commit comments