Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI does not show request body #273

Closed
dthorpe opened this issue Jul 31, 2013 · 7 comments
Closed

UI does not show request body #273

dthorpe opened this issue Jul 31, 2013 · 7 comments

Comments

@dthorpe
Copy link

dthorpe commented Jul 31, 2013

Swagger-UI does not appear to show the request body in interactive "Try it out!" operations.

For example, see the wordnik api doc for authenticating the user using a POST request:
http://developer.wordnik.com/docs.html#!/account/authenticatePost_post_1

@fehguy
Copy link
Contributor

fehguy commented Aug 2, 2014

swagger-ui is only designed to display the response body

@fehguy fehguy closed this as completed Aug 2, 2014
@enricribas
Copy link

Do you want to eloborate? These seems like a silly response to me in my humble opinion. Why does SwaggerUI only show responses? Would it not be nice to see the exact request that is being sent, ideally as a JSON object?

@fehguy
Copy link
Contributor

fehguy commented Oct 28, 2014

I think it depends on what swagger-ui is being used for. If interactive documentation, then the inputs for the request are the right scope of information. If as a debugging tool, then yes I can understand why you'd want to have the full raw request. If that's your goal, I'd suggest forking the UI and rendering the data--everything is available in the underlying swagger-js library.

@dthorpe
Copy link
Author

dthorpe commented Oct 28, 2014

Raw request vs "inputs for the request" is a pedantic distinction at this point - Swagger doesn't display request bodies in any form currently. All you can see is the output, not the input. As documentation for a web API, Swagger shows you only half of the information required to form a usable POST request.

@webron
Copy link
Contributor

webron commented Dec 10, 2014

I don't follow your distinction between request bodies and request parameters.

@boeboe
Copy link

boeboe commented Dec 10, 2014

Oh sorry, I thought this was basic HTTP terminology.

>> GET /api/user?gender=male [request parameter]

@ApiOperation(value = "Get users")
@RequestMapping(value = "", method = RequestMethod.GET)
public List<User> getUsers(@RequestParam(value = "gender", required = false) String gender) { ... }


>> POST /api/user with HTTP request body content [request body]

    {
        name : "john doe"
        genader: "male"
    }

@ApiOperation(value = "Create a user")
@RequestMapping(value = "", method = RequestMethod.POST)
public User createUsers(@RequestBody @Valid User user) { ... }

@webron
Copy link
Contributor

webron commented Dec 10, 2014

Since you opened #771, let's keep the correspondence there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants