我很难弄清楚如何在swagger 2.0中嵌套模型.
目前我有:
SomeModel:
properties:
prop1:
type: string
prop2:
type: integer
prop3:
type:
$ref: OtherModel
OtherModel:
properties:
otherProp:
type: string
Run Code Online (Sandbox Code Playgroud)
我尝试了很多其他方法:
prop3:
$ref: OtherModel
# or
prop3:
schema:
$ref: OtherModel
# or
prop3:
type:
schema:
$ref: OtherModel
Run Code Online (Sandbox Code Playgroud)
以上都不适用.
但是,使用数组工作正常:
prop3:
type: array
items:
$ref: OtherModel
Run Code Online (Sandbox Code Playgroud) swagger ×1