ajv-validator / ajv-validator/ajv-cli

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

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

描述

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`

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

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

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