swagger-combine
swagger-combine copied to clipboard
Enable automatic OperationID conflicts resolving
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
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.