|
126 | 126 | <section title="Keyword Behaviors">
|
127 | 127 | <t>
|
128 | 128 | JSON Schema keywords fall into several general behavior categories.
|
129 |
| - Assertions validate that an instance satisfies constraints, annotations |
130 |
| - attach information that applications may use in any way they see fit, |
131 |
| - and applicators allow for building more complex schemas than a single |
132 |
| - schema object would allow. |
| 129 | + Assertions validate that an instance satisfies constraints, producing |
| 130 | + a boolean result. Annotations attach information that applications |
| 131 | + may use in any way they see fit. Applicators allow for building more |
| 132 | + complex schemas than a single schema object would allow, by causing |
| 133 | + additional schemas to be evaluated. |
| 134 | + </t> |
| 135 | + <t> |
| 136 | + Keyword behavior MAY be defined in terms of the annotation results |
| 137 | + of <xref target="root">subschemas</xref> and/or adjacent keywords. |
| 138 | + Such keywords MUST NOT result in a circular dependency. |
| 139 | + Keywords MAY modify their behavior based on the presence or absence |
| 140 | + of another keyword in the same |
| 141 | + <xref target="schema-document">schema object</xref>. |
| 142 | + </t> |
| 143 | + <t> |
| 144 | + A missing keyword MUST NOT produce a false assertion result, MUST |
| 145 | + NOT produce annotation results, and MUST NOT cause any other schema |
| 146 | + to be evaluated as part of its own behavioral definition. |
| 147 | + However, given that missing keywords do not contribute annotations, |
| 148 | + the lack of annotation results may indirectly change the behavior |
| 149 | + of other keywords. |
| 150 | + </t> |
| 151 | + <t> |
| 152 | + In some cases, the missing keyword assertion behavior of a keyword is |
| 153 | + identical to that produced by a certain value, and keyword definitions |
| 154 | + SHOULD note such values where known. However, even if the value which |
| 155 | + produces the default behavior would produce annotation results if |
| 156 | + present, the default behavior still MUST NOT result in annotations. |
| 157 | + </t> |
| 158 | + <t> |
| 159 | + Because annotation collection can add significant cost in terms of both |
| 160 | + computation and memory, implementations MAY opt out of this feature. |
| 161 | + Keywords known to an implementation to have assertion or applicator behavior |
| 162 | + that depend on annotation results MUST then be treated as errors, unless |
| 163 | + an alternate implementation producing the same behavior is available. |
| 164 | + Keywords of this sort SHOULD describe reasonable alternate approaches |
| 165 | + when appropriate. |
133 | 166 | </t>
|
134 | 167 | <t>
|
135 | 168 | Extension keywords SHOULD stay within these categories, keeping in mind
|
|
175 | 208 | </t>
|
176 | 209 | <t>
|
177 | 210 | An instance can only fail an assertion that is present in the schema.
|
178 |
| - In some cases, this no-op behavior is identical to a keyword that exists with |
179 |
| - certain values, and keyword definitions SHOULD note such values where known. |
180 |
| - These default behaviors MUST NOT result in assertion failures. |
| 211 | + |
181 | 212 | </t>
|
182 | 213 | <section title="Assertions and Instance Primitive Types">
|
183 | 214 | <t>
|
|
0 commit comments