swagger-api / swagger-api/swagger-codegen

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

Open
#9,916 0 comments 0 reactions 1 assignee View on GitHub

@gracekarina is already working on this.

Since Apr 22, 2020.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.