I want to validate just a single key in a big object which could have lots of different undefined keys.
I cannot do this today since the Object validator will throw when keys that are not specified in schema exists in object.
Therefore i propose a metod for the Object validator to make all keys allowed, and just do given validation.
Example:
var obj = {
foo: {
bar: {
value: 5
IWillbeCheckedAndWillThrow: true,
},
iWillNotBeCheckedEither: true,
},
iWillNotBeChecked: true,
};
var Schema = Duns.object().keys({
foo: Duns.object().keys({
bar: Duns.object().keys({
value: Duns.number().max(6),
}),
}).allowAllKeys(),
}).allowAllKeys();
Duns.validate(obj, Schema) //Will return false since it will still will not validate the 'IWillbeCheckedAndWillThrow' key. But all other keys will be ok.
I want to validate just a single key in a big object which could have lots of different undefined keys.
I cannot do this today since the Object validator will throw when keys that are not specified in schema exists in object.
Therefore i propose a metod for the Object validator to make all keys allowed, and just do given validation.
Example: