openapi-generator
openapi-generator copied to clipboard
[BUG][java-vertx-web] Textual responses get wrapped in JSON
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);
}
...