ajv-validator / ajv-validator/ajv

Coercion support for JTD

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

描述

**What version of Ajv you are you using?**

v8.12.0

**What problem do you want to solve?**

Currently AJV doesn't support the `coerceTypes` option when using JSON type definitions. When you import from `ajv/dist/jdt` and try to pass `coerceTypes` to the constructor you get a "not assignable to undefined" type error.

![image](https://github.com/ajv-validator/ajv/assets/31548851/0779cf5d-087f-4c81-adb2-fd234ebf3f8f)

**What do you think is the correct solution to problem?**

I think it would be good to implement support for this since it is already supported when using JSON schemas. A simple use case is coercing the values from url query parameters.

**Will you be able to implement it?**

Probably not.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

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

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