Skip to content

Commit 2120b03

Browse files
Stop warning
1 parent 66d3ee3 commit 2120b03

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tavern/_core/schema/jsonschema.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def is_object_or_sentinel(checker, instance):
6666
)
6767

6868

69-
def oneOf(validator, oneOf, instance, schema):
69+
def oneOf(validator: jsonschema.protocols.Validator, oneOf, instance, schema):
7070
"""Patched version of 'oneof' that does not complain if something is matched by multiple branches"""
7171
subschemas = enumerate(oneOf)
7272
all_errors = []
@@ -82,7 +82,9 @@ def oneOf(validator, oneOf, instance, schema):
8282
context=all_errors,
8383
)
8484

85-
more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
85+
more_valid = [
86+
s for i, s in subschemas if validator.evolve(schema=s).is_valid(instance)
87+
]
8688
if more_valid:
8789
more_valid.append(first_valid)
8890
reprs = ", ".join(repr(schema) for schema in more_valid)

0 commit comments

Comments
 (0)