Forum Discussion

Deekay's avatar
Deekay
Regular Visitor
5 years ago

Nested Schema produces error when generating C# Client SDK

I get the following error, when I try to generate the Client SDK in C# in SwaggerHub.

There was an error generating the clients C# code. Please ensure that the definition and all external refs (inc. domains) are valid

I get no syntax errors, but I have pinpointed the error to the following nested schemes (see below).

If I replace the ErrorMessage-Reference in the SemanticErrorMessage-Schema with any other Schema, it works.

Somehow with the double nesting it doesn't.

Could someone give me a hint, how to nest this properly?

 

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