在swaggerhub中,我正在尝试构建一个restful API。为此,我已经为请求创建了n个POJO。我想将它们表示为其他POJO示例中的引用:
ClientInformation:
type: object
schema:
$ref: '#/definitions/EditClient'
$ref: '#/definitions/OtherDetails' #Duplicate mapping key error I see at this line
properties:
notes:
type: string
example: This is a test
description: A description我尝试过,,但不起作用。敬请指教。
发布于 2019-01-12 05:41:22
如果ClientInformation是EditClient和OtherDetails模式的合并,则需要allOf
ClientInformation:
allOf:
- $ref: '#/definitions/EditClient'
- $ref: '#/definitions/OtherDetails'
- type: object
properties:
notes:
type: string
example: This is a test
description: A description如果ClientInformation的属性是其他模式的实例,则可以按如下方式对属性模式执行$ref操作:
ClientInformation:
type: object
properties:
notes:
type: string
example: This is a test
description: A description
foo:
$ref: '#/definitions/EditClient'
bar:
$ref: '#/definitions/OtherDetails'https://stackoverflow.com/questions/54127422
复制相似问题