Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Ignore mypy error for lambda
Browse files Browse the repository at this point in the history
Also added a docstring for the validation function. πŸ˜‰

Signed-off-by: Major Hayden <major@redhat.com>
  • Loading branch information
major authored and F-X64 committed Nov 3, 2022
1 parent 530a52d commit d1a94d1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/rhelocator/update_images/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,20 @@


def validate_json(data: str) -> None:
"""Validate a JSON document against the schema.
Args:
data: JSON string to validate.
Returns:
None if the schema is valid, or raises a ValidationError if it is invalid.
"""
try:
validator = Draft202012Validator(SCHEMA)
errors = sorted(validator.iter_errors(data), key=lambda e: e.path)
errors = sorted(
validator.iter_errors(data),
key=lambda e: e.path, # type: ignore[no-any-return]
)

if errors:
error_message = "Error validating image data: "
Expand Down

0 comments on commit d1a94d1

Please sign in to comment.