kogosoftwarellc / open-api

A Monorepo of various packages to power OpenAPI in node
MIT License
892 stars 235 forks source link

[suggestion] Merging API paths instead of reporting a duplicate URL conflict #699

Open hauru opened 3 years ago

hauru commented 3 years ago

First of all, this is a really great, quality package. Thank you for all the work you put in it.

However, i have a small problem with my current set-up which consists of a collection of independent modules each able to extend main API by appending a directory to the list of paths. Working this way i find it impossible to add HTTP methods to an already existing API URL because the corresponding path needs to be redefined in a module and doing so leads to a conflict being reported. My only option right now is to define an additional endpoint eg. /user/update instead of just adding a PUT or PATCH to /user.

I think it would be more useful if express-openapi was able to merge method-containing objects for duplicate paths.

This seems like a relatively easy modification to existing code. Unfortunately i know nothing about Typescript so there won't be any PRs from me :-(