swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

Response Content Type used to Response Body content type !

Open enigmatiqk opened this issue 13 years ago • 2 comments

can you use Response content type to define Response body format ? that can be helpfull ...

solutions:

  • Response Content Type must accept text and value ()
  • move select choice into form
  • use jquery to get selected option value and name

enigmatiqk avatar Jun 19 '13 09:06 enigmatiqk

you mean so you can type in what the accept type should be? Or the model itself?

JQuery is used under the hood for the requests, and you don't have a lot of options of what the content-type can be.

fehguy avatar Jun 19 '13 15:06 fehguy

Hi, this has been resolved in the 2.0-develop branch--could you please try it out and reopen if you still see an issue? The solution is to properly annotate the consumes and produces attributes on the operation like such:

      "operations": [
        {
          "method": "POST",
          "summary": "Add a new pet to the store",
          "notes": "",
          "responseClass": "void",
          "nickname": "addPet",
          "produces": [
            "application/json",
          ],
          "consumes": [
            "application/json",
            "application/xml"
          ],
          "parameters": [
             ....

This will now provide a parameter content type drop-down under the body field (for choosing XML, JSON, etc) as well as a response content type for selecting the return type from the server.

Documentation will follow soon, please try that out and reopen if you see issues.

fehguy avatar Jul 07 '13 08:07 fehguy