fastest-validator
fastest-validator copied to clipboard
Strict for deep objects
Is it possible to set strict mode (yes/remove) to the deep objects somehow?
const schema = {
$$strict: true,
set: {
type: 'object',
props: {
a: { type: 'number', min: 0, max: 1, optional: true },
b: { type: 'number', min: 0, max: 1, optional: true },
},
},
set2: {
type: 'object',
props: {
a: { type: 'number', min: 0, max: 1, optional: true },
b: { type: 'number', min: 0, max: 1, optional: true },
},
},
};
const payload = {
set: {
c: false,
d: 'xxx',
}
}
look at object documentation, you have the strict property https://github.com/icebob/fastest-validator#object