我很难弄清楚如何在 OpenAPI 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