Skip to content

Commit

Permalink
Merge pull request #27 from alanisaac/issue-20-validation-message
Browse files Browse the repository at this point in the history
Enhanced validation messages for key errors.
  • Loading branch information
query-jeremy authored May 13, 2024
2 parents 72d762f + 9b0a55b commit d6637d5
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions ocsf_validator/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,8 @@ def __init__(
else:
trail_str = ".".join(trail)

if cls is None:
cls_str = ""
else:
cls_str = cls.__name__ + "."

super().__init__(
f"Missing required key `{cls_str}{key}` at `{trail_str}` in {file}"
f"Missing required key `{key}` at `{trail_str}` in {file}. Make sure required fields in this file and any supporting files such as dictionaries or includes are populated."
)


Expand All @@ -113,13 +108,8 @@ def __init__(
else:
trail_str = ".".join(trail)

if cls is None:
cls_str = ""
else:
cls_str = cls.__name__

super().__init__(
f"Unrecognized key `{key}` of `{cls_str}` at `{trail_str}` in {file}"
f"Unrecognized key `{key}` at `{trail_str}` in {file}. Make sure fields in this file and any supporting files such as dictionaries or includes are valid."
)


Expand Down

0 comments on commit d6637d5

Please sign in to comment.