robertmassaioli / openapi-merge

Merge multiple OpenAPI 3.0 (Swagger) files together via a library or CLI tool.
MIT License
131 stars 26 forks source link

Merge OpenAPI paths based on specific tags #100

Open osimhi213 opened 5 months ago

osimhi213 commented 5 months ago

Hello,

I'm currently exploring the capabilities of OpenAPI and I'm curious if there's a way to merge multiple service Swagger files while selecting only the paths that have a specific tag. I've reviewed the documentation but couldn't find any details on this particular functionality.

For instance, let's consider the following scenario: I have a merge.json file with inputs from multiple services: { "inputs": [ { "inputFile": "service1/dist/functions/api/swagger.json" }, { "inputFile": "service2/dist/functions/api/swagger.json"
}, { "inputFile": "service3/dist/functions/api/swagger.json"
} ], "output": "./dist/service.output.swagger.json" }

In this scenario, I'd like to include only the paths from service1 Swagger that comply with the "Service1" tag. Paths from service1 that don't comply with this tag should be excluded from this merged Swagger. Using the Hidden() decorator isn't suitable for my needs, as I would like to include the other tags in different merged swaggers.

Thanks in advance!