我正在尝试伪造一个JSON模式的层次结构,它至少有4个级别,当我尝试使用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
}
},
}
}
}