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

Enable automatic OperationID conflicts resolving

Open Bohdan-Kalynovskyi opened this issue 2 years ago • 1 comments

I'm trying to merge several swagger files from similar APIs. Each swagger file contains the ping endpoint having the same OperationID:

"/ping": { "get": { "operationId": "getPing",

This results in a conflict. --continueOnError does not help, the combined file is not generated.

IMHO, my use case is rather common, so can I open a PR that would automatically rename getPing to getPing1 or fix it in any other way?

Suggestions appreciated

Bohdan-Kalynovskyi avatar May 23 '22 13:05 Bohdan-Kalynovskyi

In our case, we have conflicts on operation Ids, so we simply removed them before merging

    # Swagger specification https://swagger.io/specification/
    # - the operationId field must be unique, it used for the code generation but does not matter here, get rid of it
    sed -i -e "/^.*operationId:.*$/d" tmp/src/*.yaml

Look at "Renaming Path OperationIds" in https://www.npmjs.com/package/swagger-combine

if you cannot track all the conflict an automatic renaming option could be nice.

odupuy avatar May 30 '22 18:05 odupuy