openapi-merge icon indicating copy to clipboard operation
openapi-merge copied to clipboard

Add support to merge duplicate oas paths using disputePrefix

Open robertmassaioli opened this issue 4 years ago • 6 comments

Moved from: https://bitbucket.org/echo_rm/openapi-merge/issues/4/add-support-to-merge-duplicate-oas-paths

Screen Shot 2021-09-04 at 2 48 49 pm

Screen Shot 2021-09-04 at 2 49 00 pm

While trying to use your library we ran into an issue where our library has a preset amount of paths and a client application that can override them. Because we also use express-openapi-validator we need a cleanly merged OAS file between the two. I’ve created a fix and associated tests but am unable to open a pull request. You can find my proposed solution here: https://bitbucket.org/drethic/openapi-merge/src/oas-path-dispute-prefix/.

Thank you for your consideration in fixing this issue.

[edit-1]

Note: If the newer path only adds/overrides an operation it will replace the whole path. I’ll think on a cleaner solution but in the short term this should get one step closer to seamless merging of two files with identical paths.

robertmassaioli avatar Sep 04 '21 04:09 robertmassaioli

@robertmassaioli Thank you for keeping this issue alive. Did you want me to move the proposed solution code from bitbucket to here?

Drethic avatar Sep 07 '21 14:09 Drethic

If you could that would be convenient, thankyou. I'm re-evaluating all of these issues when time allows. Cheers.

robertmassaioli avatar Sep 07 '21 20:09 robertmassaioli

I'm looking for something similar here - I have a need to merge a command and a query service into a single swagger file. So for example the command side might have a path "/users" with a POST and the query side would have the same path "/users" with a GET. Any idea if the above would resolve this and if the PR will go through any time soon?

Thanks!

macux avatar Mar 16 '22 11:03 macux

I have been meaning to migrate the code I pushed to Bitbucket but due to work priorities I have not been able to get it ported and updated per the threads above. The original branch is here if you or @robertmassaioli want to pull it over, clean it up, and see about getting it merged. For me I've just used it locally as that project requires.

Drethic avatar Mar 16 '22 12:03 Drethic

Would this cover the case where you have one spec with a get operation and another with a post, under the same path? Any plans to add this functionality?

malaclypse avatar Aug 26 '22 08:08 malaclypse

https://github.com/robertmassaioli/openapi-merge/pull/78 resolves this to some degree, however it has 2 other changes mixed in to the MR.

  • Deep Merge Security Scheme
  • Allow non-unique Operation ID (with flag)
  • Merge non-conflicting operation(s) in each path (this)

dbryar avatar Sep 05 '22 00:09 dbryar