Swagger 组件/模式之外的可重用组件?

Swagger 组件/模式之外的可重用组件?,swagger,openapi,Swagger,Openapi,在组件/schema之外是否还有其他地方可以放置可重用组件 我有一个“部分”(因为没有更好的术语),我想在别处$ref,但我不想成为“模型”: 一些例子: NotFoundError: type: object properties: code: type: integer format: int32 example: 404 message: type: string example: "Resource No

组件/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

一个可能的解决方案是将partials放在一些下面,例如
x-partials
,并相应地更改
$ref
s
$ref
不关心路径是什么,只要目标是预期格式

x部分:
身份证件:
类型:整数
格式:int32
示例:1
组件:
模式:
ID数组:
类型:数组
项目:
$ref:“#/x-partials/ID”
真的吗
ID只读:
所有:
-$ref:“#/x-partials/ID”
-只读:正确
ID可写:
所有:
-$ref:“#/x-partials/ID”
-真的吗
例如,通过这种方式,片段将不会显示在Swagger UI的“模型”部分