尝试在SwaggerHub中使用嵌套方案生成C#客户端SDK时出错

时间:2019-11-05 21:52:00

标签: inheritance swagger swaggerhub

当我尝试在SwaggerHub中使用C#生成客户端SDK时,出现以下错误。

  

生成客户端C#代码时出错。请确保定义和所有外部参考(包括域)均有效

我没有语法错误,但是我已将错误定位到以下嵌套方案(见下文)。

如果我将SemanticErrorMessage-Schema中的ErrorMessage-Reference替换为其他任何模式,则可以使用。

以某种方式具有双重嵌套却没有。

有人可以提示我如何正确嵌套吗?

openapi: 3.0.2

components:
  schemas:

    SimpleErrorMessage:
      title: Simple Error Message
      description: Simple Error Message
      type: object
      required:
      - error
      - message
      properties:
        error:
          description: Error-Code
          type: string
          example: 'SomethingWentWrong'
        detail:
          description: Additional details information for the error-code
          type: string
          nullable: true
        message:
          description: |
            \(Technical\) Error-Description.
            Not intended to be displayed in the User-Interface! 
          type: string
          example: 'Something went wrong'
        time: 
          description: Timestamp
          type: string
          format: date-time
          nullable: true

    ErrorMessage:
      title: Error Message
      description: Error Message
      allOf:
      - $ref: '#/components/schemas/SimpleErrorMessage'
      - type: object
        properties:
          additionalInformation:
            description: for debugging
            type: object
            nullable: true
            properties:
              version: 
                description: API-Version
                type: string
                nullable: true
                example: 1.3.23
              caller:
                description: Information about the client sending the query
                type: string
                nullable: true
              receiver:
                description: Information about the server handling the query
                type: string
                nullable: true
              location:
                description: Information about the Class handling the query
                type: string
                nullable: true
              query:
                description: The query received by ZEUS
                type: object
                nullable: true
                properties:
                  method:
                    description: http method
                    type: string
                    nullable: true
                    example: 'PUT'
                  path:
                    description: resource path
                    type: string
                    nullable: true
                    example: '/api/v1/somethings/123456789'
                  body:
                    description: request body
                    type: string
                    nullable: true
                    example: '[ { "id": 1234567, "descr": "test", ...'

    SemanticErrorMessage:
      allOf:
      - $ref: '#/components/schemas/ErrorMessage'
      - type: object
        properties:
          displayMessage:
            type: string

0 个答案:

没有答案