ajv-validator / ajv-validator/ajv-errors

Property name template not working in unevaluatedProperties

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

描述

The property name template {0#} works great in additionalProperties, but it does not seem to work in unevaluated properties. For example, the schema:

` "actions": {
"type": "array",
"items": {
"type": "object",
"unevaluatedProperties": {
"not": true,
"errorMessage": "Unexpected property {0#} in action object"
},
"properties": {
"_id": {
"type": "string"
},
"type": {
"enum": [
"booking",
"chat"
]
},
"className": {
"type": "string"
},
"cta": {
"type": "string"
},
"inquiryTypeId": {
"type": "string"
}
},
"required": [
"_id",
"type",
"className",
"cta"
],
"oneOf": [
{
"$ref": "#/$defs/chatAction"
},
{
"$ref": "#/$defs/bookingAction"
}
]
}
}
`

Yields an error like:
` {
"instancePath": "/0/guide/actions/1/conversionCode",
"schemaPath": "#/properties/actions/items/unevaluatedProperties/errorMessage",
"keyword": "errorMessage",
"params": {
"errors": [
{
"instancePath": "/0/guide/actions/1/conversionCode",
"schemaPath": "#/properties/actions/items/unevaluatedProperties/not",
"keyword": "not",
"params": {},
"message": "must NOT be valid",
"emUsed": true
}
]
},
"message": "Unexpected property {0#} in action object"
}`

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

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

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