question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to add the json request body in swagger ui (for java code, possibly using annotations)?

See original GitHub issue

I’m writing a dropwizard app. I want to have something similar to this result

but what I’m having is only this (it doesn’t have the json request body text form) rightnow

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:closed
  • Created 8 years ago
  • Comments:24 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
diguagecommented, Sep 30, 2018

I had the same problem. I added the annotation @RequestBody Shop shop, then the problem was resolved. Good luck!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found