首页 > 解决方案 > 如何引用与属性相同的架构?

问题描述

我的 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.

它不喜欢“描述:”如果有内部异常,则 InnerException。“如果我删除它,它不喜欢“属性:”行。我尝试了很多东西,但没有任何效果。什么我不明白吗?

标签: swaggeropenapiswagger-editor

解决方案


  • adescription是不允许的$ref。看到这个答案
  • 之前InnnerError是两个'"'。不确定这是否只是复制粘贴错误。

推荐阅读