swagger-core: @ApiParam does not show example value
I am trying to setup swagger for my rest api
In response when I mention custom response type in ApiResponse Like
@ApiResponse(code = 200, message = "Success", response = Entity.class)
I am getting example output, but when I do
@ApiParam(value = "start year", required = true, name = "startYear")Entity startYear,
I don’t get sample input body.
And it shows

Any help is appreciated.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 18 (4 by maintainers)
Why this issue was closed? Imho the issue still exists.
I have the same problem. I am using Swagger-annotations 1.5.10. I want to show the example input for the API as below. @ApiParam(value = “Input for get canonical names service”, required = true, examples = @Example(@ExampleProperty(value = "{\r\n"inputs": [{\r\n\t"entityType": "type0",\r\n\t"token": "flower"\r\n}]\r\n}))) Actually, no matter the example is what, there is no example shown in UI. But, all other attributes, e.g., value, required are displayed correctly. The only problem is the example. Is there any potential package conflicting with exampleproperty? Any help will be appreciated!
Doesn’t work, still closed!
Does not work for me too
I am having the same issue.
The example “bar123” doesn’t exist in the generated JSON.
By the way. I am also wondering why a @PathVariable is not required by default. I have to specify it explicitly.
Thanks for your help.
Not working for me too.
As per this thread it should work for path and query parameters (not body parameters), but still no luck.
https://stackoverflow.com/questions/46584658/how-can-i-set-a-description-and-an-example-in-swagger-with-swagger-annotations/51382735#51382735
The issue was closed as the OP did not provide the required details. If you still experience the issue, please file a new ticket.
Can confirm, still not working -.-"
Hey even for me @ApiImplicitParam attribute example and examples are not showing up in swagger UI. Did anyone found solution for above issue?
@dominicE @JessieGit Is it working for you guys?
Thanks Much!
Any updates on here?
Same problem with latest, 1.5.18
example and examples not working. If I open my swagger.json in editor.swagger.io it will be displayed.
Same issue with 1.5.16.
Same problem with 1.5.17