我试图伪造一个至少下降 4 级的 JSON 模式层次结构,当我尝试使用 json-schema-faker 时,我得到的输出只有 1 级,而 2 级我看到的是 [object]。有没有办法达到所有级别并伪造数据。
{
Message: {
abcd: [
[Object], <-- this is level 2 and I am seeing it as [object]
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object]
]
}
}
添加架构
{
"type": "object",
"properties": {
"Message": {
"$ref": "#/definitions/Message"
}
},
"required": ["Message"],
"definitions": {
"Message": {
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Message",
"properties": {
"abcd": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/abcd"
},
"uniqueItems": false,
"name": "abcd",
"minItems": 5,
"maxItems": 10
}
},
"ns": "default",
"searchable": [],
"validation": [],
"version": 1,
"required": ["abcd"]
},
"abcd": {
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "abcd",
"properties": {
"aa": {
"type": "number",
"name": "aa",
"from": 1
},
"bb": {
"type": "number",
"name": "bb",
"from": 1
}
},
}
}
}