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