-
-
Notifications
You must be signed in to change notification settings - Fork 110
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
Add modifier for strict schema validation #224
Conversation
For you to note @imbrn: Every modifier function can now also use the rule it is being validated on. The rule is passed to the modifier as a second argument. This change is backward compatible. This allows modifiers to act based on the rule they are on and even to validate based on the arguments given to the rule. This is important for this modifier, because it needs to change the outcome of the validation based on the configuration of the |
Thanks @barfurth. I'll take a look at that later. |
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.
It seems really good to me.
I'd like to have some other tests using other modifiers together, for example:
.not.strict
.not.some.strict
.some.not.strict
// etc
It'd be nice to also have some test to check that strict
is actually ignored by not-schema-based validations.
@imbrn I have added more tests - what do you think? |
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.
Really nice! 🤩
Description
This adds a modifier
strict
that can be used with theschema
rule. All it does it ensure that a validated schema has no additional properties. This makes a strict schema validation more locked down than comparable coding paradigms like interfaces.Thank you @dbismut for the idea.
Part of #191, inspired by #179
Type of change
Checklist:
master
Unreleased
section of the CHANGELOG