Skip to content

Commit 3432234

Browse files
vyuroshchinp1c2u
authored andcommitted
fix review
1 parent 49ad680 commit 3432234

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

openapi_schema_validator/shortcuts.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ def validate(
1515
*args: Any,
1616
**kwargs: Any
1717
) -> None:
18+
"""
19+
Validate an instance against a given schema using the specified validator class.
20+
"""
1821
schema_dict = cast(dict[str, Any], schema)
1922
cls.check_schema(schema_dict)
2023
validator = cls(schema_dict, *args, **kwargs)
21-
errors = list(validator.evolve(schema=schema_dict).iter_errors(instance))
22-
if errors:
23-
error = best_match(errors)
24-
error.message = f"Validation failed: {error.message}"
24+
error = best_match(validator.evolve(schema=schema_dict).iter_errors(instance))
25+
if error is not None:
2526
raise error

0 commit comments

Comments
 (0)