私はSwagger 1.2を使用しています。JSONネストしたオブジェクトをモデル化しようとするのは苦労します。モデルスキーマをスワッガーオンラインデモペットショップPOST /ペット(サンプル値)例えば、私のオブジェクトは、次のとおりです。Swagger-1.2:モデルスキーマでn-nested JSONオブジェクトを表示する方法
{
"parent" : {
"child_1" : {
"child_2a" : "string",
"child_2b" : {
"child_3a" : "string",
"child_3b" : ["string"]
}
}
}
}
あなたが見ることができるように、私は以上の1つのレベルのJSONを持っています。
....
stuff here
.....
api: [
{
"path": "/api/foo/bar",
"operations": [
{
"method": "POST",
"summary": "a job",
"consumes": ["application/json"],
"authorizations": {},
"parameters": [
{
"name": "body",
"required": true,
"type" : "Parent",
"description": "some description",
"paramType": "body"
},
{
"name": "fooz",
"description": "some description",
"required": false,
"type": "string",
"paramType": "query"
}
],
......
........
}
],
"models" : {
"Parent": {
"id": "Parent",
"required": ["parent"],
"properties": {
"parent": {
"$ref": "Child1"
}
}
},
"Child1": {
"id": "Child1",
"required" : ["child_1"],
"properties": {
"child_1": {
"$ref": "Child2"
}
}
},
"Child2" : {
"id" : "Child2",
"required" : ["child_2a", "child_2b"],
"properties" : {
"child_2a" : {
"type" : "string"
},
"child_2b" : {
"$ref" : "Child3"
}
}
},
"Child3" : {
"id" : "Child2",
"required" : ["child_3a", "child_3b"],
"properties" : {
"child_3a" : {
"type" : "string"
},
"child_3b" : {
"type" : "array",
"items": {
"type": "string"
}
}
}
}
しかし、モデルスキーマの表示は次のとおりです:私のparameter
アレイでは、私はこのような何か持って
{
"parent" : "Child1"
}
を私はおそらく間違った何かをしましたか? Model Schemaにネストされたオブジェクト全体を表示するにはどうすればよいですか? SwaggerデモペットストアのようにPOST/Pet Example Value
ご清聴ありがとうございます。 – leona