Closed hoffmann-david closed 1 year ago
Describe the bug
Hi I am getting a cyclic dependency error when using pick()in combination with shape() in yup 1.2.0. The problem seems similar to https://github.com/jquense/yup/issues/1969
To Reproduce
import { object, string } from 'yup'; const testObject = { a1: undefined, a2: 'over9000', }; const a1 = string().when('a2', { is: undefined, then: (schema) => schema.required(), }); const a2 = string().when('a1', { is: undefined, then: (schema) => schema.required(), }); const schema = object({ a3: string().required(), a4: string().required() }).shape({ a1, a2 }, [ ['a1', 'a2'], ]); const isValid = schema.pick(['a1', 'a2']).isValid(testObject);
Here is a very basic demo showing the resulting error: https://plnkr.co/edit/Nbdwma2bEbtSrxje
The resulting error is: Error: Cyclic dependency, node was:"a2"
Error: Cyclic dependency, node was:"a2"
Expected behavior The schema is able to validate properly for the picked fields.
Platform (please complete the following information):
@jquense is there a known way to work around this problem?
Describe the bug
Hi I am getting a cyclic dependency error when using pick()in combination with shape() in yup 1.2.0. The problem seems similar to https://github.com/jquense/yup/issues/1969
To Reproduce
Here is a very basic demo showing the resulting error: https://plnkr.co/edit/Nbdwma2bEbtSrxje
The resulting error is:
Error: Cyclic dependency, node was:"a2"
Expected behavior The schema is able to validate properly for the picked fields.
Platform (please complete the following information):