ajv-validator / ajv-validator/ajv

Disable reportTypeError to enable users to implement their own coercion rule

未關閉
#2,363 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
enhancement
主要語言
TypeScript
星號
14.8k
分支
1k
PR 合併指標
30 天內沒有已合併 PR

描述

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.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。