How can I set a description and an example in Swagger with Swagger annotations?

I have similar issue with generating examples for body objects – annotation @Example and @ExampleProperty simply doesn’t work for no reason in swagger 1.5.x. (I use 1.5.16)

My current solution is:
use @ApiParam(example="...") for non-body objects, e.g.:

public void post(@PathParam("userId") @ApiParam(value = "userId", example = "4100003") Integer userId) {}

for body objects create new class and annotate fields with @ApiModelProperty(value = " ", example = " "), e.g.:

@ApiModel(subTypes = {BalanceUpdate.class, UserMessage.class})
class PushRequest {
    @ApiModelProperty(value = "status", example = "push")
    private final String status;;
}

Leave a Comment

techhipbettruvabetnorabahisbahis forumueduedusedusedusedusedueduedueduedus