ajv-validator / ajv-validator/ajv

Support multiple property names in `discriminator` keyword

未關閉
#1,663 11 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
enhancement
主要語言
TypeScript
星號
14.8k
分支
1k
PR 合併指標
30 天內沒有已合併 PR

描述

**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...

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

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

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