Yaml OpenAPI:重写引用,引用单个字段

Yaml OpenAPI:重写引用,引用单个字段,yaml,swagger,openapi,Yaml,Swagger,Openapi,我正在使用两个文件: common.yaml包含: components: schemas: GenericError: type: object properties: code: description: The error code. type: integer message: description: The error description.

我正在使用两个文件:

common.yaml
包含:

components:

  schemas:
    GenericError:
      type: object
      properties:
        code:
          description: The error code.
          type: integer
        message:
          description: The error description.
          type: string
        details:
          description: Optional details.
          type: object

  examples:
    Bamboozled:
      value:
        code: 10
        message: Bamboozled
        details: You've been bamboozled
paths:
  /logistic:
    post:

      description: Logistic

      responses:
        403:
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '../common.yaml#/components/schemas/GenericError'
              examples:
                Bamboozled:
                  value:
                    $ref: '../common.yaml#/components/examples/Bamboozled/value'
服务.yaml`包括:

components:

  schemas:
    GenericError:
      type: object
      properties:
        code:
          description: The error code.
          type: integer
        message:
          description: The error description.
          type: string
        details:
          description: Optional details.
          type: object

  examples:
    Bamboozled:
      value:
        code: 10
        message: Bamboozled
        details: You've been bamboozled
paths:
  /logistic:
    post:

      description: Logistic

      responses:
        403:
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '../common.yaml#/components/schemas/GenericError'
              examples:
                Bamboozled:
                  value:
                    $ref: '../common.yaml#/components/examples/Bamboozled/value'
services.yaml
中,我想覆盖
详细信息
字段。我尝试了以下方法:

              examples:
                Bamboozled:
                  value:
                    $ref: '../common.yaml#/components/examples/Bamboozled/value'
                    details: my custom details
但这不起作用,它将呈现:

{
  "$ref":

  "#/paths/~1logistic/post/responses/403/content/application~1json/examples/Bamboozled/value",
"details": "my custom details"
}
有什么方法可以正确覆盖它吗

或者,我可以只引用特定字段吗?因此,我需要
服务.yaml
一些东西,例如:

              examples:
                Bamboozled:
                  value:
                    $ref: '../common.yaml#/components/examples/Bamboozled/value/code'
                    $ref: '../common.yaml#/components/examples/Bamboozled/value/message'
                    details: my custom details
(这不起作用)