adopted-ember-addons / adopted-ember-addons/ember-cp-validations

How to distinguish relation presence error from relation own fields errors

未關閉
#606 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
439
分支
172
PR 合併指標
30 天內沒有已合併 PR

描述

### Environment

- Ember Version:
3.3.1
- Ember CLI Version:
3.3.0
- Ember CP Validations Version:
3.5.3

### Steps to Reproduce

May be i am missing something but i can't find any convenient way to split relation presence error from relation own field errors. For example i have `parent` - `children` relationship and `has-many` validation
```js
export const ParentValidations = buildValidations({
children: {
validators: [
validator('has-many'),
validator('presence', { presence: true }),
],
},
});

export const ChildValidations = buildValidations({
age: {
validators: [
validator('presence'),
],
},
});
```

and there is component where i can select child and show errors
```hbs
...
{{v-get parent 'children' 'errors'}}
...
```
The problem is that this helper will not only show `child` presence validation error, but after selecting child, it will also show error about missing `child.age` field value. Can this be solved without writing additional computed properties and manually splitting errors?

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。