Describe the bug
Example:
/auth/ssoid:
post:
tags:
- Authentifizierung
summary: Anmeldung eines Users über SSOID
operationId: findBySsoid
requestBody:
required: true
content:
application/json:
schema:
type: string
responses:
'201':
description: User Objekt
content:
'application/json':
schema:
$ref: '#/components/schemas/User'
getting generated with openapi-generator:
@Operation(summary = "Anmeldung eines Users über SSOID", tags={ "Authentifizierung", }, responses = { @ApiResponse(responseCode = "201", description = "User Objekt", content = @Content(mediaType = "application/json", schema = @Schema(implementation = UserDto.class))) },security = {
@SecurityRequirement(name = "ApiKeyAuth"),@SecurityRequirement(name = "BasicAuth"),@SecurityRequirement(name = "CookieAuth") } )
@RequestMapping(
method = RequestMethod.POST,
value = "/auth/ssoid",
produces = { "application/json" },
consumes = { "application/json" }
)
default ResponseEntity<UserDto> findBySsoid(
@Parameter(name = "", required = true ) @Valid @RequestBody String body) {
return getDelegate().findBySsoid(body); -> always "null"
}
import io.swagger.v3.oas.annotations.parameters.RequestBody -> doesn't work.
To Reproduce - Spring-Boot: 1.6.2 - Spring-Doc-Open-Api: 1.6.2
Additional context - if I change from io.swagger.v3.oas.annotations.parameters.RequestBody to org.springframework.web.bind.annotation.RequestBody its work..
Comment From: wilkinsona
Spring MVC doesn't know anything about io.swagger.v3.oas.annotations.parameters.RequestBody
. It you want String body
to contain the request's body, then, from Spring's perspective at least, you will have to annotate it with org.springframework.web.bind.annotation.RequestBody
. Perhaps Springdoc adds something that means that you should be able to use Swagger's @RequestBody
in place of Spring Web's? If so and it is not working as expected, you should raise that with the Springdoc team.