adopted-ember-addons / adopted-ember-addons/ember-cp-validations
How to distinguish relation presence error from relation own fields errors
- 主要语言
- 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 还没有评估数据。