adopted-ember-addons / adopted-ember-addons/ember-changeset-validations

Provided description for validation not passed in rawOutput for buildMessage

オープン
#354 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
215
フォーク
98
PR マージ指標
30日以内にマージされた PR はありません

説明

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",

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。