Swagger 如何引用与属性相同的架构?

Swagger 如何引用与属性相同的架构?,swagger,openapi,swagger-editor,Swagger,Openapi,Swagger Editor,我的oas.yaml文件中有以下内容: components: schemas: ServiceError: type: object properties: Message: type: string description: "The exception message." ExceptionMessage: type: string Type:

我的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:”如果存在内部异常,则为“InnerException”。如果我删除该行,它也不喜欢行“Property:”。我尝试了很多东西,但都没有效果。我不明白什么?

  • 不允许在
    $ref
    处使用
    说明。请参阅
  • 在InnerError之前有两个''。不确定这是否只是一个复制粘贴错误
      • $ref
        上不允许使用
        说明。看
      • InnerError之前的
        innerError
        是两个'。不确定这是否只是一个复制粘贴错误

      如果不允许任何描述,如何在生成的代码中获取该属性的注释?感谢
      servicererror
      本身可以有
      描述
      。显示了使用
      allOf
      的解决方法。如果不允许任何描述,如何在生成的代码中获取该属性的注释?感谢
      servicererror
      本身可以有一个
      说明
      。使用
      allOf
      显示了一个解决方法。它不喜欢
      InnerError.description
      ,因为里面没有结束引号。正如Martin所说,在
      Type.description
      的末尾有一个额外的引号。您需要修复引号。它不喜欢
      InnerError.descriptionType.description
      的末尾有一个额外的引号。你需要修正引号。