ajv-validator / ajv-validator/ajv

Disable reportTypeError to enable users to implement their own coercion rule

Abierto
#2,363 1 comentario 0 reacciones 0 asignados Ver en GitHub
enhancement
Lenguaje dominante
TypeScript
Estrellas
14.8k
Forks
1k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I manage to implement my own coercion rules. The values are correctly coerced. However, I have to define in the schema all the types that may be coerced or an error is thrown by [`reportTypeError`](https://github.com/ajv-validator/ajv/blob/master/lib/compile/validate/dataType.ts#L49). Here is how I format the error in [Nikita](https://nikita.js.org/):

```
Error: NIKITA_SCHEMA_VALIDATION_CONFIG: one error was found in the configuration of root action: #/definitions/config/properties/from_string/type config/from_string must be number, type is ["number"].
```

Please provide us a way to disable calling `reportTypeError`. For information, this issue has bugged me (and my libraries) for years and is related to issue #1437.

Guía de contribución

Abrir la guía de contribución

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.