I'm posting a multipart form to a Spring Boot app.
E.g.
@PostMapping(value = "/foo", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public void postFooAsMultiPart(@RequestBody Foo foo) {
...
}
Spring does a really good job of marshalling the multipart request to an object (StandardServletMultipartResolver
).
I'm presenting the endpoint using Swagger(Springfox). Dependencies:
However, it's rendering the whole body as a single field:
http://localhost:8080/v2/api-docs
...
"parameters": [
{
"in": "body",
"name": "foo",
"description": "foo",
"required": true,
"schema": {
"$ref": "#/definitions/Foo"
}
}
],
...
My question is: Is it possible to get Swagger to render each of Foo's attributes as separate parameters?
Note: As a workaround I've used @ApiImplicitParams
to specify all Foo's attributes at the controller level. However I see this as more of a workaround rather than the correct solution.
Edit I've spent a bit of time following the code, and I'm pretty sure this can't be be done with the current version. I've opened an issue on the GitHub repo suggesting a change. I'll update/answer this question depending on the outcome.
Yep. This was a bug. Fixed now (in 2.9.1).