LucyBot-Inc / api-spec-converter

Convert API descriptions between popular formats such as OpenAPI(fka Swagger), RAML, API Blueprint, WADL, etc.
https://lucybot-inc.github.io/api-spec-converter/
MIT License
1.11k stars 181 forks source link

Conversion from Swagger spec 1.2 to 2.0 adds HTTP 200 response if not present #136

Open robertmorrell-inttra opened 7 years ago

robertmorrell-inttra commented 7 years ago

I didn't see this issue brought up in the other issues, but I am experiencing a problem when i define an API that does not use an HTTP 200 (OK) response, (instead it used a 204), and during conversion a 200 response is added to the output json which an invalid reference.

Example: 1.2 spec: "responseMessages" : [ { "code" : 204, "message" : "No-Content - Updated successfully" }, { "code" : 400, "message" : "Invalid parameters passed", "responseModel" : "ExceptionModel" }, { "code" : 500, "message" : "An error has occurred", "responseModel" : "ExceptionModel" } ]

Converted 2.0 spec "responses": { "200": { "description": "No response was specified", "schema": { "$ref": "#/definitions/Response" } }, "204": { "description": "No-Content - Updated successfully" }, "400": { "description": "Invalid parameters passed", "schema": { "$ref": "#/definitions/ExceptionModel" } }, "500": { "description": "An internal error has occurred", "schema": { "$ref": "#/definitions/ExceptionModel" } } }

MikeRalphson commented 7 years ago

I have raised an issue as above with the swagger-converter project which is used to convert Swagger 1.2 definitions to Swagger/OpenAPI 2.0.

robertmorrell-inttra commented 7 years ago

Ok thank you. Does that help this project as well?

MikeRalphson commented 7 years ago

@robertmorrell-inttra yes, that module is used by api-spec-converter for Swagger 1.2 definitions.

robertmorrell-inttra commented 7 years ago

I see. Thank you.

rbren commented 7 years ago

For reference, here's the issue this depends on: https://github.com/apigee-127/swagger-converter/issues/78

Once that's closed we'll update the dependency here.

joepeding commented 3 years ago

@rbren This issue has been solved in swagger-converter version 2.0.0.