swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

[Spring] using schemas from domains do not work/exist once generated

Open Jdonn1995 opened this issue 6 years ago • 0 comments

I have a domain with the following schema in it

components:
  ####################
  # Common data models
  ####################
  schemas:
    ServerResponse:
      type: object
      properties:
        error:
          type: string
          example: "Authorization"
        suberror:
          type: string
          example: "Password Expired"
        return_code:
          type: string
          example: "200"

and it gets used in a scehma in my api

ShipmentBasicInfoResponse:
      type: object
      properties:
        headers:
          $ref: 'https://api.swaggerhub.com/domains/COMPANY/DOMAIN/VERSION#/components/schemas/ServerResponse'
        body:
          $ref: '#/components/schemas/ShipmentBasicInfo'

I'm generating the server through swaggerhub. When this gets generated into a spring boot server, I the ShipmentBasicInfoResponse object builds with the following field

@Valid
public HttpsapiSwaggerhubComdomainsCOMPANYDOMAINVERSIONcomponentsschemasServerResponse getHeaders() {
    return headers;
  }

HttpsapiSwaggerhubComdomainsCOMPANYDOMAINVERSIONcomponentsschemasServerResponse is not a class that was generated, making the class that calls it unusable and the project unable to compile.

Jdonn1995 avatar Dec 05 '19 15:12 Jdonn1995