We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bc25733 commit ef2ba4aCopy full SHA for ef2ba4a
openapi_schema_validator/shortcuts.py
@@ -1,4 +1,7 @@
1
-from typing import Any, Hashable, Mapping, Type
+from typing import Any
2
+from typing import Hashable
3
+from typing import Mapping
4
+from typing import Type
5
6
from jsonschema.exceptions import best_match
7
from jsonschema.protocols import Validator
@@ -28,9 +31,6 @@ def validate(
28
31
"""
29
32
cls.check_schema(schema)
30
33
validator = cls(schema, *args, **kwargs)
- errors = list(validator.evolve(schema=schema).iter_errors(instance))
-
- if errors:
34
- error = best_match(errors)
35
- error.message = f"Validation failed: {error.message}"
+ error = best_match(validator.evolve(schema=schema).iter_errors(instance))
+ if error is not None:
36
raise error
0 commit comments