我很難想出如何在swagger 2.0中嵌套模型。在swagger 2.0上的模型的屬性參考(嵌套)
目前我有:
SomeModel:
properties:
prop1:
type: string
prop2:
type: integer
prop3:
type:
$ref: OtherModel
OtherModel:
properties:
otherProp:
type: string
我已經嘗試了很多其他方式:
prop3:
$ref: OtherModel
# or
prop3:
schema:
$ref: OtherModel
# or
prop3:
type:
schema:
$ref: OtherModel
以上都不似乎工作。
然而,隨着陣列工作得很好:
prop3:
type: array
items:
$ref: OtherModel
你能看看http://stackoverflow.com/questions/35127186/swagger-2-x-reference-model-from-other-file是否有使用JSON而不是一個問題yaml? – Gobliins 2016-02-01 09:43:17