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

Provided description for validation not passed in rawOutput for buildMessage #354

Open
freyjameetsmel opened this issue Feb 20, 2024 · 0 comments · May be fixed by #355
Open

Provided description for validation not passed in rawOutput for buildMessage #354

freyjameetsmel opened this issue Feb 20, 2024 · 0 comments · May be fixed by #355

Comments

@freyjameetsmel
Copy link

Hey there, 👋

I'm currently working on internationalizing our application. This also includes all our validation messages. To get this to work properly for the default messages

  • I moved them to our translation files (ember-intl),
  • updated our validations/messages.js to hold the translation paths,
  • set the rawOutput to true in the environment.js and
  • implemented a template helper to render the correct translation with all the needed context.

This works as expected, except for the provided descriptions.

Example

Validation when creating the changeset

lastname: [
  validatePresence({ presence: true, description: 'Nachname' }),
],

RawOutput

{
    "value": "",
    "type": "present",
    "message": "validation.defaultMessages.present", // path for tranlation for ember-intl
    "context": {
        "presence": true,
        "description": "Lastname" // expected to be "Nachname"
    }
}

The rendered description in the rawOutput is basically the key, but should be the description provided by the validation, if present. 🤔

I hope I did not overlook something that could result in the correct behaviour for our application.
I could also try to provide a PR for this issue.

Thanks ✨ Mel


Version used

"ember-changeset-validations": "4.1.1",

@freyjameetsmel freyjameetsmel linked a pull request Feb 21, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant