I am providing material-ui components for react-formal to render. As part of the material design spec for required fields, I need to display an asterisk in the label.
With me so far? Great.
I'm using yup - awesome - love it. So:
Given a schema
const schema = yup.object({
firstName: yup.string().trim().default('').required('First name is required')
})
When I render a custom material-ui field
Then I need to inspect the yup schema to determine if it is required
I see that I receive meta with the StringSchema:
I didn't spot anything in the yup api, can I query the StringSchema somehow to determine required?
I am providing material-ui components for react-formal to render. As part of the material design spec for required fields, I need to display an asterisk in the label.
With me so far? Great.
I'm using yup - awesome - love it. So:
Given a
schema
When I render a custom material-ui field Then I need to inspect the yup schema to determine if it is
required
I see that I receive
meta
with theStringSchema
:I didn't spot anything in the yup api, can I query the
StringSchema
somehow to determinerequired
?