-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: ✨ add check error matcher #972
base: feat/sprout-checks-7-check-properties
Are you sure you want to change the base?
feat: ✨ add check error matcher #972
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very simple class for encapsulating matching logic. The motivation behind this is that filtering CheckError
s or deciding if a CheckError
fulfills any of a set of conditions comes up pretty often.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put this class and exclude_errors.py
into checks
because they are generally applicable, but we can move them to sprout_checks
if we think they should be restricted to Sprout.
def json_path_matches(self, error: CheckError) -> bool: | ||
"""Determines if this matcher matches the `json_path` of the given `CheckError`. | ||
|
||
Matching on the full `json_path` and matching on the field name are supported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can obviously be refined further (e.g. to allow matching fields with a specific name on resources only), but we can add that as/if we need it. Same goes for message_matches
.
…eck-error-matcher
…eck-error-matcher
Description
This PR adds a
CheckErrorMatcher
object. This is/will be used to filter out unwanted errors easily.Example usage:
I'm going to use this to replace the
check_required
flag in Sprout's check functions.Closes #
This PR needs an in-depth review.
Checklist
just run-all