ajv-validator / ajv-validator/ajv-errors

ErrorMessage with Array of strings

Aperta
#70 4 commenti 4 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
289
Fork
21
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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 ?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.