16

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
4

2 に答える 2