[2.0 Spec] Responses Object

27 views
Skip to first unread message

mission liao

unread,
Apr 12, 2015, 9:09:27 PM4/12/15
to swagger-sw...@googlegroups.com
Hi,

    I just check petstore example and wonder how it works.
    The spec says that:
       The Responses Object MUST contain at least one response code, and it SHOULD be the response for a successful operation call.

    And in current petstore example (http://petstore.swagger.io/v2/swagger.json), I can't find a '200' or 'default' response object in 'addPet' operation.
            "responses":{

               "405":{

                  "description":"Invalid input"

               }

            },


     But the example app (http://petstore.swagger.io) actually works well when I tried that operation.

     I'm not sure about the right way to implement such logic, any hint?


    

Ron Ratovsky

unread,
Apr 13, 2015, 1:42:43 AM4/13/15
to swagger-sw...@googlegroups.com
It just means that the object has to contain at least one response definition and we recommend that at least one response is a successful one.

That pet store sample works as plan, though it does not exhibit the best practice. Since 'addPet' should return a 2XX response for a successful operation, feel free to open a ticket on swagger-core about it.

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------
Reply all
Reply to author
Forward
0 new messages