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 摘要。