-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: validate property values are not empty #247
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM - one n.p.
]), | ||
), | ||
) | ||
.required(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a taste thing, I'd prefer to leave required in the parent object, rather than here. It's functionally identical, but I think maps slightly better to where optionality is defined in the parent, rather than in the object itself, similar to the smithy and typescript definitions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can move required
up.
Are you suggesting like this?
const propertiesSchema = yup.lazy((value) => {
return yup
.object()
.shape(...)
}).required();
Gives error:
Property 'required' does not exist on type 'Lazy<O...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh no, just remove from this definition entirely, then in the Component validator, it'd be like properties: propertiesSchema.required(),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah makes sense, good idea.
45dd545
to
b43c297
Compare
b43c297
to
527739f
Compare
527739f
to
b5aa9e2
Compare
b5aa9e2
to
c364931
Compare
Validates that a property value is not an empty object.