ajv-validator / ajv-validator/ajv-cli

"error: nullable value must be ["boolean"]" does not give line number

Ouverte
#111 1 commentaire 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
316
Forks
77
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

I got this error:

```
schema docs/endpoints/schemas/get-employee.json is invalid
error: nullable value must be ["boolean"]
```
but unlike the other schema validation error messages, there is no hint as to _where_ this error is coming from. It turned out that I had accidentally added `nullable: "true"` (this was a typo) in just one of the 100+ instances of nullable. This was extremely hard to find, and the error message didn't make it clear what the problem was in the first place.

Also, a suggestion to make the error message a bit easier to understand:

`nullable value type must be one of ["boolean"]` or just `nullable value must be of type boolean` (seems to be no reason to include a confusing array if there is only one possible type). Even better: `nullable value must be of type boolean, not string`

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.