swagger-samples
swagger-samples copied to clipboard
UpdatePet operation in Petstore swagger specifies only the negative response codes(400, 404, 405)
From http://petstore.swagger.io/v2/swagger.json :
"put": {
"tags": [
"pet"
],
"summary": "Update an existing pet",
"description": "",
"operationId": "updatePet",
"consumes": [
"application/json",
"application/xml"
],
"produces": [
"application/xml",
"application/json"
],
"parameters": [
{
"in": "body",
"name": "body",
"description": "Pet object that needs to be added to the store",
"required": true,
"schema": {
"$ref": "#/definitions/Pet"
}
}
],
"responses": {
"400": {
"description": "Invalid ID supplied"
},
"404": {
"description": "Pet not found"
},
"405": {
"description": "Validation exception"
}
},
See also https://github.com/swagger-api/swagger-samples/blob/master/java/inflector-dropwizard-guice/src/main/swagger/swagger.yaml#L62
You can see that responses array includes values for 400, 404 and 405 only. Why 200 is not included? This breaks C# auto-generated code, see https://github.com/Azure/autorest/issues/1859
We can modify the sample (and PRs are welcome), however if this breaks the C# auto-generated code, I'd suggest they fix it over there because it is not wrong. The generated code should not be that fragile.