Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JAVA] 3.0.65 java stub generates method with no return value for get endpoints if $ref is used #12504

Open
leberknecht opened this issue Dec 18, 2024 · 0 comments

Comments

@leberknecht
Copy link

leberknecht commented Dec 18, 2024

Description

With 3.0.65 the methods that are generated for get endpoints (havent checked others) are not returning anything. Same specs worked with 3.0.64.

The generated code looks like this:

    public void whateverGet() throws ApiException {
        whateverGetWithHttpInfo();
    }

while with 3.0.64:

    public InlineResponse200 whateverGet() throws ApiException {
        ApiResponse<InlineResponse200> resp = whateverGetWithHttpInfo();
        return resp.getData();
    }

If i put the schema directly, without using the $ref, the generated code is having the return statement.

Swagger-codegen version

3.0.65

Swagger declaration file content or url
openapi: 3.0.1
paths:
  /whatever:
    get:
      responses:
        "200":
          $ref: "#/components/responses/WhateverGetResponse"

components: 
  responses: 
    WhateverGetResponse:
      description: test
      content:
        application/json:
          schema:
            type: object
            properties:
              name:
                type: string
Command line used for generation

java -jar ~/Downloads/swagger-codegen-cli-3.0.65.jar generate -i test.yaml -l java -o ./debug -DhideGenerationTimestamp=true

Steps to reproduce

just generate with 3.0.65

Related issues/PRs
Suggest a fix/enhancement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant