I am not seeing the requestBody in the resulting openApi.json.
Below is a method in my java class with gradle swagger dependency: io.swagger:swagger-jaxrs2:2.0.0-rc1
No matter what I try I don't get the resulting RequestBody structure as detailed in the
documentation. It's documenting the NewPerson param in the parameters array instead. It is interesting that in
rc1, the Operation takes a RequestBody, but in
rc2 they dropped that. Confusing.
The resulting openApi.json:
"post": {
"parameters": [
{
"schema": {
"$ref": "#/components/schemas/NewPerson"
}
}],
"responses": {
"200": {
"content":
...
}
}
}
The code:
import io.swagger.oas.annotations.Operation;
import io.swagger.oas.annotations.media.Content;
import io.swagger.oas.annotations.media.Schema;
import io.swagger.oas.annotations.parameters.RequestBody;
import io.swagger.oas.annotations.responses.ApiResponse;
@POST
@Produces({MediaType.APPLICATION_JSON})
@Consumes(MediaType.APPLICATION_JSON)
@Operation()
public Response post(
@RequestBody(description = "New Person", required = true, content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = NewPerson.class))) NewPerson np
)
{}