ajv-validator / ajv-validator/ajv-errors

ErrorMessage with Array of strings

Abierto
#70 4 comentarios 4 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
289
Forks
21
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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 ?

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.