openapi如何以扩展方式重用已定义的对象

时间:2019-11-11 03:34:10

标签: openapi

已定义的对象

OneObject:
  type: object
  properties:
    AProperty:
      type: string
    BProperty:
      type: string

另一个对象:

AnotherObject:
  type: object
  properties:
    AProperty:
      type: string
    BProperty:
      type: string
    CProperty:
      type: string   

由于AProperty中已经定义了BPropertyOneObject,所以我想重用它。然后我猜可能是这样的:

AnotherObject:
  type: object
  properties:
    CProperty:
      type: string  
  anyOf:
    - required: [CProperty]
    - required: [OneObject]

但没有。

0 个答案:

没有答案