Closed Chrisposure closed 1 year ago
yes, validateAt, expects a root value, not the field value. Please double check your usage against the documentation: https://github.com/jquense/yup#schemavalidateatpath-string-value-any-options-object-promiseinfertypeschema-validationerror
Calling validateAt for a numeric field currently always comes with a numeric zero value into the test method:
` // validateAt call: await mySchema.validateAt('numericField', 4, { context: { optionA: 'A' } })
// test method: const myTest = (value: number, context: TestContext) => {
console.log(value) // value is always ZERO!
}
// schema: const mySpec = { numericField: number().label('Numeric Field').required().default(0).test('MY-TEST', myTest), = object(mySpec ).strict(true)`
} const mySchema: ObjectSchema
When I call isValid directly on the spec the value is correct:
await mySpec.numericField.isValid(4, { context: { optionA: 'A' } })
What am I doing wrong?