I am having the following controller:
public interface GetScoreController {
@GetMapping(value = "/score", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(parameters = {@Parameter(in = ParameterIn.QUERY, name = "request")})
Score getScore(ScoreRequest request);
}
And I'd like OpenApi to show all the attributes in ScoreRequest
as query params when generating the Swagger documentation since this is the result when the request is a POJO:
I don't know if actually, OpenApi allows this, but if I have too many request params it is more useful to collect them in a unique POJO.
Add @ParameterObject annotation to method signature.
Score getScore(@ParameterObject ScoreRequest request);
}