Closed zschiller closed 2 years ago
const test = schema.object({ test: schema.string().required(), }); const partial = test.partial(); partial.validateSync({});
This throws the following runtime error:
ValidationError: test is a required field
I would expect that .partial() makes all the fields optional, am I using it wrong here somehow?
.partial()
can you provide a repro with the template?
@jquense https://codesandbox.io/s/thirsty-wildflower-7cspmv?file=/src/index.test.js
fixed in https://github.com/jquense/yup/releases/tag/v1.0.0-beta.3
@jquense I'm not sure i'm doing something wrong, but for me partial isn't working correctly.
partial
I thought validate should return the input, instead it's returning an object with all the defined props from the schema.
validate
validate doesn't return the input, it returns the cast value: https://github.com/jquense/yup#object-schema-defaults
This throws the following runtime error:
I would expect that
.partial()
makes all the fields optional, am I using it wrong here somehow?