Skip to content
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

mixed.label does not work in version 0.30.0. "label-string" is replacing the "key-name" in both the "key" and the "error message". #1122

Closed
diegopelusa opened this issue Nov 23, 2020 · 0 comments

Comments

@diegopelusa
Copy link

Describe the bug
mixed.label(label: string): Schema overrides not only the key name in the error message, but also the key itself

To Reproduce
Until version 0.30.0, I have this code running properly in a Formik-Form with a Yup-ValidationSchema:

const validationSchema = object({
email: string()
.label(t("email"))
.email(t("email_valid"))
.required(t("field_required"))
});

NOTE: the t("xxx") texts were built with an i18n library

Expected behavior

The expected behaviour was that the error was shown as:
"key-name": "XXXXXXXXXXXXXXX -> text where the key-name is replaced by the label"

Current behavior

In version 0.30.0 the behaviour is:
"label": "XXXXXXXXXXXXXXX -> text where the key-name is replaced by the label"

That makes that the Formik-Form-Field does not recognize that error as the one corresponding to the Field-key.

The validation throws the error correctly, but the key is changed, and therefore the Field does not find the error corresponding to its key.

Platform (please complete the following information):

  • Browser: Firefox, Chrome
  • Version: 0.30.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant