-
Notifications
You must be signed in to change notification settings - Fork 182
Open
Description
schemaPath that were returned from validateResult are not always consistent. For example, multipleOf rule are not included:
const schema = {
type: 'object',
properties: {
num: {
type: 'number',
minimum: 5,
multipleOf: 2,
},
},
};
// schemaPath missing "multipleOf"
tv4.validateResult({ num: 1 }, schema);
// {
// error: {
// message: "Value 1 is not a multiple of 2",
// params: {
// value: 1,
// multipleOf: 2
// },
// code: 100,
// dataPath: "/num",
// schemaPath: "/properties/num",
// subErrors: null,
// stack: "(...omitted...)"
// },
// missing: [],
// valid: false
// }
tv4.validateResult({ num: 2 }, schema);
// {
// error: {
// message: "Value 2 is less than minimum 5",
// params: {
// value: 2,
// minimum: 5
// },
// code: 101,
// dataPath: "/num",
// schemaPath: "/properties/num/minimum",
// subErrors: null,
// stack: "(...omitted...)"
// },
// missing: [],
// valid: false
// }Metadata
Metadata
Assignees
Labels
No labels