Skip to content

Commit ef2ba4a

Browse files
author
vyuroshchin
committed
fix review
1 parent bc25733 commit ef2ba4a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

openapi_schema_validator/shortcuts.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
from typing import Any, Hashable, Mapping, Type
1+
from typing import Any
2+
from typing import Hashable
3+
from typing import Mapping
4+
from typing import Type
25

36
from jsonschema.exceptions import best_match
47
from jsonschema.protocols import Validator
@@ -28,9 +31,6 @@ def validate(
2831
"""
2932
cls.check_schema(schema)
3033
validator = cls(schema, *args, **kwargs)
31-
errors = list(validator.evolve(schema=schema).iter_errors(instance))
32-
33-
if errors:
34-
error = best_match(errors)
35-
error.message = f"Validation failed: {error.message}"
34+
error = best_match(validator.evolve(schema=schema).iter_errors(instance))
35+
if error is not None:
3636
raise error

0 commit comments

Comments
 (0)