Home Ask Login Register

Developers Planet

Your answer is one click away!

sash February 2016

Dropwizard Swagger complex post Objects annotations

I am using drop wizard with swagger to document my rest api. I begin with adding annotations to my existing resource classes to generate the document. But now I have a post request where i am required to post custom model such as parameters below.

  public class Parameters {

    private final String param1;
    private final String param2;
    private final String param3;

    public Parameters(String param1, String param2, String param3) {
        this.param1 = param1;
        this.param2 = param2;
        this.param3 = param3;

    public String getParam1() {
        return param1;

    public String getParam2() {
        return param2;

    public String getParam3() {
        return param3;

I annotated the post method like below but the documents are not generated for this method, could any one please guide me in the right direction to get this working?

    @ApiOperation(value = "Adding params")
public Response addParams(@ApiParam(required = true)Parameters params){



fehguy February 2016

It looks like you need to post a complex value based on a POJO named Parameters. Make sure that you have a no-arg constructor for the class and that you have getters & setters. Then it will appear as a body parameter with a json structure containing param1, param2, param3, all as strings.

Post Status

Asked in February 2016
Viewed 1,412 times
Voted 5
Answered 1 times


Leave an answer

Quote of the day: live life