swagger 编辑器在另一个定义中引用定义
swagger editor reference definition inside another definition
在我的定义中,我使用了继承。在下面的示例中,PERSON-PATCH 属性毫无问题地进入。现在我想获取 PERSON-BIO 属性并显示它是 PersonGet 中的一个子对象。我不知道这样做的语法。
PersonBio:
type: object
properties: &PERSON-BIO
nickname:
type: string
description: The nickname for the Person
... other properties chopped out ...
minProperties: 1
PersonGet:
type: object
properties:
<<: *PERSON-PATCH
ident:
type: integer
format: int32
description: The SQL ident of the Person
bio:
<<: *PERSON-BIO
好的,刚刚弄明白了;
PersonGet:
type: object
properties:
<<: *PERSON-PATCH
bio:
$ref: '#/definitions/PersonBio'
在我的定义中,我使用了继承。在下面的示例中,PERSON-PATCH 属性毫无问题地进入。现在我想获取 PERSON-BIO 属性并显示它是 PersonGet 中的一个子对象。我不知道这样做的语法。
PersonBio:
type: object
properties: &PERSON-BIO
nickname:
type: string
description: The nickname for the Person
... other properties chopped out ...
minProperties: 1
PersonGet:
type: object
properties:
<<: *PERSON-PATCH
ident:
type: integer
format: int32
description: The SQL ident of the Person
bio:
<<: *PERSON-BIO
好的,刚刚弄明白了;
PersonGet:
type: object
properties:
<<: *PERSON-PATCH
bio:
$ref: '#/definitions/PersonBio'