在swaggerhub中,我试图构建一个宁静的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
我尝试了,
,但是没有用。请提出。
答案 0 :(得分:0)
如果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'