-
Notifications
You must be signed in to change notification settings - Fork 94
Closed
Description
Hi,
i've come across an issue with the custom validator on root object schemas.
The custom validator is not handled when we create a root object schema.
const schemaRoot = {
type: 'object',
$$root: true,
props: {
prop1: { type: 'string', optional: true },
prop2: { type: 'string', optional: true },
},
custom: (v, errors, schema, object) => {
console.log(v, errors, schema, object);
return v;
}
};
The result when validating the schema is:
--------------------
ROOT object test
--------------------
Data: { prop1: '' }
Schema: {
type: 'object',
'$$root': true,
props: {
prop1: { type: 'string', optional: true },
prop2: { type: 'string', optional: true }
},
custom: [Function: custom]
}
Validate Result: true
I've created a repl.it repository with test demo.
Metadata
Metadata
Assignees
Labels
No labels