martypitt/swagger-springmvc — pull request #394 by acwatson (2014-08-08 00:42:55+00:00)
Title: Added Support for Flattened Form Beans

Marty - I love your plugin! I was trying to figure out how I could create a Spring controller method that takes a complex type in the request, while still having the Swagger UI show individual input form fields instead of a big text area. I looked through the plugin code and it did not seem to support what I was trying to do, so I added the functionality. I probably didn't make changes as cleanly as you would, but I thought I would submit this pull request anyway so that maybe you or someone else would add the functionality in some form or another. Here is a sample Spring controller operation that I got working so that all of the Person attributes displayed in Swagger UI as form fields. I made the behavior optional, so that developers need to add the @BeanParam attribute to their method param in order to have this functionality take effect.

@RequestMapping(value = {"/createPerson"}, method = POST, produces = APPLICATION_JSON_VALUE)
@ApiOperation(value = "Creates and returns a Person",
notes="Populates a Person instance using the data supplied in the posted form fields")
public Person createRandomPersonWithBeanParam(

@BeanParam
final Person person, final BindingResult result) {

return person;
}