Arrays JSON模式:数组项的定义
我试图在JSON模式中定义一个数组元素。它们数组包含已在架构的Arrays JSON模式:数组项的定义,arrays,definition,jsonschema,Arrays,Definition,Jsonschema,我试图在JSON模式中定义一个数组元素。它们数组包含已在架构的definitions部分中定义的类型中的项 我试过: "properties": { "userId": {"$ref": "#/definitions/userId"}, "beacons": { "type": "array", "items": { "$ref": "#/definitions/beaconSchema" } } } 用#/definitions/use
definitions
部分中定义的类型中的项
我试过:
"properties": {
"userId": {"$ref": "#/definitions/userId"},
"beacons": {
"type": "array",
"items": { "$ref": "#/definitions/beaconSchema" }
}
}
用#/definitions/userId
解析userId
部分。但是,列表项会忽略#/definitions/beaconSchema
,并允许其中包含任何旧垃圾
如何使用JSON模式
定义
解析JSON数组中的所有项?您发布的模式片段是正确的。我建议您在$ref
路径和定义属性名称中查找输入错误。如果没有发现问题,请尝试发布更多架构。您发布的架构片段是正确的。我建议您在$ref
路径和定义
属性名称中查找拼写错误。如果您没有发现问题,请尝试发布更多架构。@Jason如果您是正确的,则定义中缺少additionalProperties
键。请写下这封信作为回答,我会接受的。很高兴你找到了答案。就是这样-定义中缺少了一个additionalProperties
键。谢谢(顺便说一句,你有这个问题的完美用户名)