|
162 | 162 | that depend on annotation results MUST then be treated as errors, unless
|
163 | 163 | an alternate implementation producing the same behavior is available.
|
164 | 164 | Keywords of this sort SHOULD describe reasonable alternate approaches
|
165 |
| - when appropriate. |
| 165 | + when appropriate. This approach is demonstrated by the |
| 166 | + "<xref target="additionalItems" format="title"/>" and |
| 167 | + "<xref target="additionalProperties" format="title"/>" keywords in this |
| 168 | + document. |
166 | 169 | </t>
|
167 | 170 | <t>
|
168 | 171 | Extension keywords SHOULD stay within these categories, keeping in mind
|
|
1227 | 1230 | <section title="Keywords for Applying Subschemas to Arrays">
|
1228 | 1231 | <section title="items">
|
1229 | 1232 | <t>
|
1230 |
| - The value of "items" MUST be either a valid JSON Schema or an array of valid |
1231 |
| - JSON Schemas. |
| 1233 | + The value of "items" MUST be either a valid JSON Schema or |
| 1234 | + an array of valid JSON Schemas. |
1232 | 1235 | </t>
|
1233 | 1236 | <t>
|
1234 | 1237 | If "items" is a schema, validation succeeds if all elements
|
|
1240 | 1243 | same position, if any.
|
1241 | 1244 | </t>
|
1242 | 1245 | <t>
|
1243 |
| - Omitting this keyword has the same behavior as an empty schema. |
| 1246 | + This keyword produces an annotation value which is the largest |
| 1247 | + index to which this keyword applied a subschema. The value |
| 1248 | + MAY be a boolean true if a subschema was applied to every |
| 1249 | + index of the instance, such as when "items" is a schema. |
| 1250 | + </t> |
| 1251 | + <t> |
| 1252 | + Annotation results from multiple "items" keyword are combined |
| 1253 | + by setting the combined result to true if any of the values |
| 1254 | + are true, and otherwise retaining the larges numerical value. |
| 1255 | + </t> |
| 1256 | + <t> |
| 1257 | + Omitting this keyword has the same assertion behavior as |
| 1258 | + an empty schema. |
1244 | 1259 | </t>
|
1245 | 1260 | </section>
|
1246 | 1261 |
|
1247 |
| - <section title="additionalItems"> |
| 1262 | + <section title="additionalItems" anchor="additionalItems"> |
1248 | 1263 | <t>
|
1249 | 1264 | The value of "additionalItems" MUST be a valid JSON Schema.
|
1250 | 1265 | </t>
|
1251 | 1266 | <t>
|
1252 |
| - If "items" is an array of schemas, validation succeeds |
1253 |
| - if every instance element at a position greater than the size |
1254 |
| - of "items" validates against "additionalItems". |
| 1267 | + The behavior of this keyword depends on the presence and |
| 1268 | + annotation result of "items" within the same schema object. |
| 1269 | + If "items" is present, and its annotation result is a number, |
| 1270 | + validation succeeds if every instance element at an index |
| 1271 | + greater than that number validates against "additionalItems". |
1255 | 1272 | </t>
|
1256 | 1273 | <t>
|
1257 |
| - Otherwise, "additionalItems" MUST be ignored, as the "items" |
1258 |
| - schema (possibly the default value of an empty schema) is |
1259 |
| - applied to all elements. |
| 1274 | + Otherwise, if "items" is absent or its annotation result |
| 1275 | + is the boolean true, "additionalItems" MUST be ignored. |
1260 | 1276 | </t>
|
1261 | 1277 | <t>
|
1262 |
| - Omitting this keyword has the same behavior as an empty schema. |
| 1278 | + If the "additionalItems" subschema is applied to any |
| 1279 | + positions within the instance array, it produces an |
| 1280 | + annotation result of boolean true, analogous to the |
| 1281 | + single schema behavior of "items". |
| 1282 | + </t> |
| 1283 | + <t> |
| 1284 | + Omitting this keyword has the same assertion behavior as |
| 1285 | + an empty schema. |
| 1286 | + </t> |
| 1287 | + <t> |
| 1288 | + Implementation MAY choose to implement or optimize this keyword |
| 1289 | + in another way that produces the same effect, such as by directly |
| 1290 | + checking for the presence and size of an "items" array. |
| 1291 | + Implementations that do not support annotation collection MUST do so. |
1263 | 1292 | </t>
|
1264 | 1293 | </section>
|
1265 | 1294 |
|
|
1269 | 1298 | </t>
|
1270 | 1299 | <t>
|
1271 | 1300 | An array instance is valid against "contains" if at least one of
|
1272 |
| - its elements is valid against the given schema. |
| 1301 | + its elements is valid against the given schema. This keyword |
| 1302 | + does not produce annotation results. |
| 1303 | + <cref> |
| 1304 | + Should it produce a set of the indices for which the |
| 1305 | + array element is valid against the subschema? "contains" |
| 1306 | + does not affect "additionalItems" or any other current |
| 1307 | + or proposed keyword, but the information could be useful, |
| 1308 | + and implementation that collect annotations need to |
| 1309 | + apply "contains" to every element anyway. |
| 1310 | + </cref> |
1273 | 1311 | </t>
|
1274 | 1312 | </section>
|
1275 | 1313 | </section>
|
|
1287 | 1325 | corresponding schema.
|
1288 | 1326 | </t>
|
1289 | 1327 | <t>
|
1290 |
| - Omitting this keyword has the same behavior as an empty object. |
| 1328 | + The annotation result of this keyword is the set of instance |
| 1329 | + property names matched by this keyword. Multiple annotation |
| 1330 | + results for "properties" are combined by taking the union |
| 1331 | + of the sets. |
| 1332 | + </t> |
| 1333 | + <t> |
| 1334 | + Omitting this keyword has the same assertion behavior as |
| 1335 | + an empty object. |
1291 | 1336 | </t>
|
1292 | 1337 | </section>
|
1293 | 1338 |
|
|
1305 | 1350 | schema that corresponds to a matching regular expression.
|
1306 | 1351 | </t>
|
1307 | 1352 | <t>
|
1308 |
| - Omitting this keyword has the same behavior as an empty object. |
| 1353 | + The annotation result of this keyword is the set of instance |
| 1354 | + property names matched by this keyword. Multiple annotation |
| 1355 | + results for "patternProperties" are combined by taking the union |
| 1356 | + of the sets. |
| 1357 | + </t> |
| 1358 | + <t> |
| 1359 | + Omitting this keyword has the same assertion behavior as |
| 1360 | + an empty object. |
1309 | 1361 | </t>
|
1310 | 1362 | </section>
|
1311 | 1363 |
|
1312 |
| - <section title="additionalProperties"> |
| 1364 | + <section title="additionalProperties" anchor="additionalProperties"> |
1313 | 1365 | <t>
|
1314 | 1366 | The value of "additionalProperties" MUST be a valid JSON Schema.
|
1315 | 1367 | </t>
|
1316 | 1368 | <t>
|
| 1369 | + The behavior of this keyword depends on the presence and |
| 1370 | + annotation results of "properties" and "patternProperties" |
| 1371 | + within the same schema object. |
1317 | 1372 | Validation with "additionalProperties" applies only to the child
|
1318 |
| - values of instance names that do not match any names in "properties", |
1319 |
| - and do not match any regular expression in "patternProperties". |
| 1373 | + values of instance names that do not appear in the annotation |
| 1374 | + results of either "properties" or "patternProperties". |
1320 | 1375 | </t>
|
1321 | 1376 | <t>
|
1322 | 1377 | For all such properties, validation succeeds if the child instance
|
1323 | 1378 | validates against the "additionalProperties" schema.
|
1324 | 1379 | </t>
|
1325 | 1380 | <t>
|
1326 |
| - Omitting this keyword has the same behavior as an empty schema. |
| 1381 | + The annotation result of this keyword is the set of instance |
| 1382 | + property names validated by this keyword's subschema. |
| 1383 | + </t> |
| 1384 | + <t> |
| 1385 | + Omitting this keyword has the same assertion behavior as |
| 1386 | + an empty schema. |
| 1387 | + </t> |
| 1388 | + <t> |
| 1389 | + Implementation MAY choose to implement or optimize this keyword |
| 1390 | + in another way that produces the same effect, such as by directly |
| 1391 | + checking the names in "properties" and the patterns in |
| 1392 | + "patternProperties" against the instance property set. |
| 1393 | + Implementations that do not support annotation collection MUST do so. |
1327 | 1394 | </t>
|
1328 | 1395 | </section>
|
1329 | 1396 |
|
|
0 commit comments