Servers array is not concatenated/merged
Opened this issue · 4 comments
Moved from: https://bitbucket.org/echo_rm/openapi-merge-cli/issues/8/servers-array-is-not-concatenated-merged
It looks like when merging it takes the 1st server array and doesn’t merge the remaining. When running locally with the merged json different paths or ports will not work correctly.
The most common reason that developers want to do this is because they have multiple services that they wish to expose underneath a single API Gateway. Therefore, even though this merging logic is sufficiently generic to be used for most use cases, some of the feature decisions are tailored for that specific use case.
This is a snippet from the readme and this is one of those cases. I assumed that the first OpenAPI file in the list would be the template for the gateway itself. In most cases, people would put the different servers for the API gateway itself and you actively don’t want any of the other servers from the services behind the gateway to appear.
As a result, I’m wondering if you can describe your use-case more to explain why this is the behaviour that you want? Maybe we can make “merge the Servers together” be an option that you can pass through to the merge algorithm? Cheers!
I'm going to resolve this issue on the 1st of October 2021 if there is no further response.
sorry for chiming in on this issue and i don't have a use case for this particular question. for me it would be useful to maintain the server at the path level instead of merging it all to the top. the use case for this would be that when you import the openapi spec into an API management tool the backend for the paths is easier match
"paths": { "/pathfromfile1": { "servers": [ { "url": "https://file1server/api" } ], "get": { }, "/pathfromfile2": { "servers": [ { "url": "https://file2server/api" } ], "get": {
@dgcaron this is the best example you gave, @robertmassaioli still you have any solution for that?
Because i am also looking this example