ajv-validator / ajv-validator/ajv

Support multiple property names in `discriminator` keyword

Đang mở
#1,663 11 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
TypeScript
Star
14.8k
Fork
1k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

**What version of Ajv you are you using?**

8.6

**What problem do you want to solve?**

My schema depends on value of two fields, so I wanted to implement something like this:

```
{
type: 'object',
discriminator: { propertyName: ['a', 'b'] }
required: ['a', 'b'],
oneOf: [
{
properties: {
a: { const: true }
b: { const: 'b' }
c: { type: 'string' }
}
},
{
properties: {
a: { const: false }
b: { const: 'bb' }
c: { type: 'number' }
}
}
...
]
}
```

**What do you think is the correct solution to problem?**

Add ability to define multiple properties in `discriminator`

**Will you be able to implement it?**

I am not sure...

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.