Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays JSON模式:数组项的定义_Arrays_Definition_Jsonschema - Fatal编程技术网

Arrays 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

我试图在JSON模式中定义一个数组元素。它们数组包含已在架构的
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
键。谢谢(顺便说一句,你有这个问题的完美用户名)