You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've encountered a strange issue related to the documentation generated by OpenAPI. If the @RequestBody annotation and its corresponding parameter are placed last in the endpoint method's parameters, the description for the RequestBody is not generated by OpenAPI (see example below). This issue seems to occur only with String parameters.
Expected behavior
{
"/fruits/{fruitName}/description": {
"put": {
"tags": [
"Fruit Resource"
],
"parameters": [
{
"name": "fruitName",
"in": "path",
"description": "The name of the fruit",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"description": "The new fruit description", // <===== description is present
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK"
}
}
}
}
}
@PUT
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.APPLICATION_JSON)
@Path("{fruitName}/description")
public Response editDescription(
@Parameter(description = "The name of the fruit", required = true)
@PathParam("fruitName") String fruitName,
@RequestBody(description = "The new fruit description", required = true) String description
) {
// ...
return Response.ok().build();
}
start the application with ./mvnw quarkus:dev
retrieve the documentation on http://localhost:8080/q/openapi or through Swagger UI
Output of uname -a or ver
No response
Output of java -version
openjdk version "21.0.3" 2024-04-16 LTS
Quarkus version or git rev
3.14.4
Build tool (ie. output of mvnw --version or gradlew --version)
Apache Maven 3.8.6
Additional information
If you put @RequestBody as the first parameter it works
@PUT
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.APPLICATION_JSON)
@Path("{fruitName}/description")
public Response editDescription(
@RequestBody(description = "The new fruit description", required = true) String description,
@Parameter(description = "The name of the fruit", required = true)
@PathParam("fruitName") String fruitName
) {
// ...
return Response.ok().build();
}
The text was updated successfully, but these errors were encountered:
Describe the bug
Hi everyone! 👋
I've encountered a strange issue related to the documentation generated by OpenAPI. If the
@RequestBody
annotation and its corresponding parameter are placed last in the endpoint method's parameters, the description for the RequestBody is not generated by OpenAPI (see example below). This issue seems to occur only withString
parameters.Expected behavior
Actual behavior
How to Reproduce?
FruitResource
class:./mvnw quarkus:dev
http://localhost:8080/q/openapi
or throughSwagger UI
Output of
uname -a
orver
No response
Output of
java -version
openjdk version "21.0.3" 2024-04-16 LTS
Quarkus version or git rev
3.14.4
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.6
Additional information
If you put
@RequestBody
as the first parameter it worksThe text was updated successfully, but these errors were encountered: