ajv-validator / ajv-validator/ajv-errors

ErrorMessage with Array of strings

Aberta
#70 4 comentários 4 reações 0 responsáveis Ver no GitHub
Linguagem predominante
TypeScript
Estrelas
289
Forks
21
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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 ?

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.