ajv-validator / ajv-validator/ajv-errors

ErrorMessage with Array of strings

未关闭
#70 4 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
289
派生
21
PR 合并指标
30 天内没有已合并 PR

描述

Hey everybody,

I have some issues when i'm trying to put errorMessage with an array, for example, this is my schema :

```
"pictures": {
"type": "array",
"items": {
"type": "string",
"pattern": "A_SPECIFIC_PATTERN_TO_PUT_HERE"
},
"errorMessage": {
"type": "INVALID_MEDIA_PICTURES_ITEMS",
}
},
```
When the pattern doesn't match, I don't receive errorMessage keyword, but instead :

```
error {
keyword: 'pattern',
dataPath: '/media/pictures/0',
schemaPath: 'media-schema.json/properties/pictures/items/pattern',
params: {
pattern: 'A_SPECIFIC_PATTERN_TO_PUT_HERE'
},
message: 'should match pattern A_SPECIFIC_PATTERN_TO_PUT_HERE'
}
```
I would like to receive my `INVALID_MEDIA_PICTURES_ITEMS`. I have the feeling errorMessage only works with `type: object`

Am I missing something here ?

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。