How to add the json request body in swagger ui (for java code, possibly using annotations)?
See original GitHub issueI’m writing a dropwizard app. I want to have something similar to this
but what I’m having is only this (it doesn’t have the json request body text form)
my annotations are like these
@POST
@UnitOfWork
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Create a new shop", response = long.class, consumes="application/json")
@ApiResponses(value = {
@ApiResponse(code = 406, message = R.ERROR_SHOP_NAME_EXISTED),
@ApiResponse(code = 404, message = R.ERROR_USER_NOT_FOUND),
@ApiResponse(code = 201, message = "shop id") })
public Response create(Shop shop) {
How do I make it work like the first picture? Thanks.
Issue Analytics
- State:
- Created 8 years ago
- Comments:24 (10 by maintainers)
Top Results From Across the Web
how to show JSON Body- Swagger-annotations - Stack Overflow
Created a POJO and used @RequestBody annotation with it instead of inputString. @RequestMapping(value = "/api/entity/{entityId}/user/query", ...
Read more >Swagger java annotations in action - ITNEXT
Annotated classes, value objects, methods, and parameters are used as input to the swagger generator. The output is a swagger definition file, it...
Read more >Setting Example and Description with Swagger - Baeldung
In this tutorial, we'll demonstrate how to use Swagger annotations to make our documentation more descriptive. First, we'll learn how to add ......
Read more >Swagger UI tutorial | Documenting APIs - Idratherbewriting.com
Swagger UI provides a display framework that reads an OpenAPI ... After you click Try it out, the example value in the Request...
Read more >Swagger RESTful API Documentation Specification
The files describing the RESTful API in accordance with the Swagger specification are represented as JSON objects and conform to the JSON standards....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had the same problem. I added the annotation
@RequestBody Shop shop
, then the problem was resolved. Good luck!@adcoolguy - check out https://github.com/swagger-api/swagger-samples/tree/master/java/java-servlet.