Closed ML-Marco closed 1 week ago
springdoc-openapi v1.8.0 is the latest Open Source release supporting Spring Boot 2.x and 1.x. An extended support for springdoc-openapi v1 project is now available for organizations that need support beyond 2023. For more details, feel free to reach out: sales@springdoc.org
You should move to OpenAPI 3.1 to Allow requestBody creation for GET see #1814 Or move to 2.6.0, which has better support
@bnasslahsen I also tested it with 2.6.0. Same problem with OpenAPI 3.0. Do you plan to support only OpenAPI 3.1 with upcoming releases or is this maybe an oversight?
@ML-Marco,
Both are supported.
But the @RequestBody
for GET
operations, is only allowed in OpenAPI 3.1 and not OpenAPI 3.0.
This comes from the spec.
You might be right. I'm not absolutely sure of it. The OpenApi 3.0.3 spec references RFC7231 here in the description of requestBody
. In that document, it says:
A payload within a GET request message has no defined semantics; sending a payload body on a GET request might cause some existing implementations to reject the request.
So, while discouraged, I'd say it's technically allowed. What do you think?
@ML-Marco,
I am not refering to the RFC. It's not allowed in OpenAPI 3.0 spec. If you need it, you have to move to OpenAPI 3.1 spec.
This results in a definition where
myClass
parameter is defined to appear"in": "query"
. Correct behavior would be arequestBody
block with $ref schema. Neitherorg.springframework.web.bind.annotation.RequestBody
norio.swagger.v3.oas.annotations.parameters.RequestBody
work.Actual
Expected part
It would be nice if a fix could be backported to the 1.8.x release 🙏.