Incorrect input schema when multiple method params are used
See original GitHub issueDescribe the bug
Generated schema includes all method parameters as “body” parameter, although it should include only @RequestBody
parameter.
To Reproduce
A simple rest controller with a single method:
@RequestMapping(method = RequestMethod.POST) public ResultDto doSomething(Device device, @RequestBody @Valid SomeDto dto)
Device is a bean parsed from a request by DeviceHandlerMethodArgumentResolver
, but instead of Device, there can be any other dynamically injected types (like custom types related to security, etc).
Generated schema includes Device, although it shouldn’t, as only SomeDto is annotated with @RequestBody
:
{
"device": {
"normal": true,
"mobile": true,
"tablet": true,
"devicePlatform": "IOS"
},
"dto": {
"foo": "string",
"bar": "string"
}
}
Expected behavior
Generated schema should include only @RequestBody
parameter.
I tried to check the documentation, but haven’t found anything related to this problem. Am I missing something?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
@ayzenquwe,
You can combine
@ParameterObject
Device device using v1.4.0.@RequestMapping(method = RequestMethod.POST) public ResultDto doSomething(@ParameterObject Device device, @RequestBody @Valid SomeDto dto)
If it doesn’t answser your request. You can add more details about your expected OpenAPI genereated api-docs.
I was talking about Spring
@RequestBody
, sorry for confusion. 😃