-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
unknown(false) is not work when configuration "allowUnknown" is true #2824
Comments
It looks like a bug. In the meantime, you can replace |
Thanks Marsup. $_setFlag(name, value, options = {}) {
Assert(name[0] === '_' || !this._inRuleset(), 'Cannot set flag inside a ruleset');
const flag = this._definition.flags[name] || {};
if (DeepEqual(value, flag.default)) {
value = undefined;
}
if (DeepEqual(value, this._flags[name])) {
return this;
}
} It is so weird to set the value to undefined when value same as the default value of flag. But once I delete this if statement, many tests failed. Please help have a check. |
Hi folks. Could I work on that issue? |
It's not the easiest one but sure. |
Thanks @Marsup . |
@geeksilva97 that's precisely the problem, it should fail on object d because g is not allowed. |
This is expected: from the docs
you can turn on this feature by not passing |
Local should always override global, it is imo a bug. |
fair enough, i now see this is what happens in the yup lib as well
|
Support plan
Context
How can we help?
Our project use version 14 before, we want to allow all fields of all object except for some fields we don't expect
For example, we want to allow field "e" of data.d only, and allow other unknown fields for data.b and even data, we use below code:
After we use version 17, the data pass the validation, which we do not expect.
Do you have any suggestions?
The text was updated successfully, but these errors were encountered: