【发布时间】:2018-05-08 15:28:50
【问题描述】:
在components/schema之外还有其他地方可以放置可重用组件吗?
我有一个“部分”(因为没有更好的术语)想在其他地方$ref,但我不想成为“模型”:
一些例子:
NotFoundError:
type: object
properties:
code:
type: integer
format: int32
example: 404
message:
type: string
example: "Resource Not Found"
ID-Array:
type: array
items:
$ref: '#/components/schemas/ID'
writeOnly: true
ID:
type: integer
format: int32
example: 1
ID-ReadOnly:
allOf:
- $ref: '#/components/schemas/ID'
- readOnly: true
ID-WriteOnly:
allOf:
- $ref: '#/components/schemas/ID'
- writeOnly: true
【问题讨论】: