why return false if input data is not empty when required set a empty array?
还没有人认领这个 Issue。
评估
调研方向
Start in jsonschema.lua at the shown required-array handling, then reproduce the behavior with the provided schema and input object. Trace how an empty required array is interpreted and compare the result with the documented JSON Schema examples; done means the case has an agreed expected validation result and a regression check.
由索引模型根据 Issue 内容生成。
描述
I found this code in jsonschema.lua
if schema.required and #schema.required == 0 then
-- return false if the input data is not empty
ctx:stmt(sformat('if %s ~= 1 then', datakind))
ctx:stmt( ' return false, "the input data should be an empty table"')
ctx:stmt( 'end')
end
if this, when I have a schema
{
"type": "object",
"properties": {
"name": { "type": "string" }
},
"required": []
}
and a json object
{
"name": "Tom"
}
such will return an err: the input data should be an empty table
- 主要语言
- Lua
- 星标
- 136
- 派生
- 29
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
api7/jsonschema 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
api7/jsonschema#95 ·
-
难度 3/5 1-2 天 新手友好度 52/100
api7/jsonschema#105 ·
-
难度 4/5 3-5 天 新手友好度 20/100
api7/jsonschema#93 ·
-
难度 3/5 1-2 天 新手友好度 35/100
api7/jsonschema#92 ·
-
难度 2/5 1-3 小时 新手友好度 42/100
api7/jsonschema#91 ·
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
-
[Operation Enhancement]: .editorconfigと.gitattributesでdictionaryとLuaファイルの編集・改行設定を統一する可能已有人在做 @5kdn 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 80/100
5kdn/DCS-Translation-Japanese#163 ·
维护者通常 1 天内回复
-
[Bug Report]未关闭area/Cubelet area/CubeNet bug needs-triage needs:compliance
难度 2/5 1-3 小时 新手友好度 62/100
TencentCloud/CubeSandbox#1917 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
-
难度 2/5 1-3 小时 新手友好度 72/100