我如何将同一个模式引用为一个属性?

问题描述 投票:0回答:1

我在我的oas.yaml文件中有以下内容。

components:
  schemas:
    ServiceError:
      type: object
      properties:
        Message:
          type: string
          description: "The exception message."
        ExceptionMessage:
          type: string
        Type:
          type: string
          description: "The exception type.""
        InnerError:
            $ref: '#/components/schemas/ServiceError'
             description: "If there's an inner exception, the InnerException.

    Property:
      type: object
      properties:
        Name:
          type: string
          description: Name of the property.

它不喜欢那行 "description: "If there's an inner exception, the InnerException." 如果我把这句话删掉,它就不喜欢 "Property: "这一行。我试了很多办法,都没有用。我有什么不明白的地方?

swagger openapi swagger-editor
1个回答
1
投票
  • a description 不允许在 $ref. 见 本回答.
  • InnnerError 是两个'"'。不知道这是否只是一个复制粘贴的错误。
© www.soinside.com 2019 - 2024. All rights reserved.