Skip to content
Discussion options

You must be logged in to vote

I finally got this working! You can try a live demo here. The source repo is here.

Interestingly enough, I didn't have to write a custom resolver. The big breakthrough came from my colleague @jamesxliu, who realized that we shouldn't be creating yup schemas statically. So instead of const addressSchema = yup.object().shape(...) we started creating it using a function const getAddressSchema = () => (yup.object().shape(...)). This allowed yup to create the schema based on the locale that was set using yup.setLocale().

Once this started working, we made bunch of other tweaks to make parameterized validations work e.g. min/max/invalid type etc. Here are some of the interesting files to look at:

Replies: 4 comments 9 replies

Comment options

You must be logged in to vote
4 replies
@nareshbhatia
Comment options

@jorisre
Comment options

jorisre Dec 30, 2020
Collaborator

@nareshbhatia
Comment options

@jorisre
Comment options

jorisre Dec 31, 2020
Collaborator

Comment options

You must be logged in to vote
1 reply
@nareshbhatia
Comment options

Comment options

You must be logged in to vote
4 replies
@bluebill1049
Comment options

@clicktodev

This comment was marked as disruptive content.

@balzdur
Comment options

@soullivaneuh
Comment options

Answer selected by bluebill1049
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
7 participants