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

[BUG][java-vertx-web] Textual responses get wrapped in JSON #19029

Open
requiel20 opened this issue Jun 27, 2024 · 0 comments
Open

[BUG][java-vertx-web] Textual responses get wrapped in JSON #19029

requiel20 opened this issue Jun 27, 2024 · 0 comments

Comments

@requiel20
Copy link

Description

Textual responses get wrapped in JSON, the current template calls .json regardless of output type.

if (apiResponse.hasData()) {
    routingContext.json(apiResponse.getData());
}
openapi-generator version

7.2.0
Also checked on latest master via Docker

OpenAPI declaration file content or url
openapi: 3.0.3
info:
  title: Example
  version: 1.0.0
paths:
  /example:
    post:
      operationId: postExample
      responses:
        200:
          description: Successful operation
          content:
            text/plain:
              schema:
                type: string
Generation Details
openapi-generator generate \
  -i ./api.yaml \
  "-g" "java-vertx-web"
Steps to reproduce

Run the above command

Related issues/PRs
Suggest a fix

Not the cleanest, but apiHandler.mustache can be:

...
                    var data = apiResponse.getData();
                    if ((Object) data instanceof String s) {
                        routingContext.response().end(s);
                    } else {
                        routingContext.json(data);
                    }
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant