Skip to content

Commit

Permalink
Stop warning
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelboulton committed Nov 18, 2023
1 parent 66d3ee3 commit 2120b03
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tavern/_core/schema/jsonschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def is_object_or_sentinel(checker, instance):
)


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

more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)]
more_valid = [
s for i, s in subschemas if validator.evolve(schema=s).is_valid(instance)
]
if more_valid:
more_valid.append(first_valid)
reprs = ", ".join(repr(schema) for schema in more_valid)
Expand Down

0 comments on commit 2120b03

Please sign in to comment.