[BUG][Java Spring OAS3] Request body is not mapped anymore
Created by: whydoievenneedthis
Description
The request body is no longer mapped, the bean on the receiving end is empty.
openapi-generator version
5.3.1
Generation Details
Generator name: spring Config options: oas3 = true
Generated code
The following method is generated:
ResponseEntity<Response> create(
@Parameter(name = "", required = true ) @Valid @RequestBody Request request);
The problem is, it also has the following imports:
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.springframework.web.bind.annotation.*;
The org.springframework.web.bind.annotation.RequestBody
annotation is being suppressed by the oas one, and as a result, spring doesn't do any request body mapping here.
How to solve it
I don't see a place in any of the mustache files where the oas RequestBody
would be used, so it's probably safe to simply drop it from api.mustache
. If not, then use the fully qualified class name in bodyParams.mustache
. If both of them were inteded to be used here, add the fully qualified annotations for both, just so the intent is explicit.