Skip to content

Commit 8bdec06

Browse files
committed
Ignore additionalItems when items isn't present on 2019.
This is specified behavior, see json-schema-org/JSON-Schema-Test-Suite#643.
1 parent f953e97 commit 8bdec06

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ v4.18.0
88
Please file issues on the ``referencing`` tracker if there is functionality missing from it, or here on the ``jsonschema`` issue tracker if you have issues with existing code not functioning the same, or with figuring out how to change it to use ``referencing``.
99
* Support for Python 3.7 has been dropped, as it is nearing end-of-life.
1010
This should not be a "visible" change in the sense that ``requires-python`` has been updated, so users using 3.7 should still receive ``v4.17.3`` when installing the library.
11+
* On draft 2019-09, ``unevaluatedItems`` now properly does *not* consider items to be evaluated by an ``additionalItems`` schema if ``items`` is missing from the schema, as the specification says in this case that ``additionalItems`` must be completely ignored.
1112

1213
v4.17.3
1314
=======

jsonschema/_legacy_validators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,6 @@ def find_evaluated_item_indexes_by_schema(validator, instance, schema):
231231
return []
232232
evaluated_indexes = []
233233

234-
if "additionalItems" in schema:
235-
return list(range(0, len(instance)))
236-
237234
if "$ref" in schema:
238235
resolved = validator._resolver.lookup(schema["$ref"])
239236
evaluated_indexes.extend(
@@ -248,6 +245,9 @@ def find_evaluated_item_indexes_by_schema(validator, instance, schema):
248245
)
249246

250247
if "items" in schema:
248+
if "additionalItems" in schema:
249+
return list(range(0, len(instance)))
250+
251251
if validator.is_type(schema["items"], "object"):
252252
return list(range(0, len(instance)))
253253
evaluated_indexes += list(range(0, len(schema["items"])))

0 commit comments

Comments
 (0)