Combine multiple swagger files
Asked Answered
P

2

7

I was provided Swagger 2.0 json files for a RESTful API my project is using. The provider does not have SDK, so I'm using the Swagger files to generate a starting point to use for integrating with the service. It's split into 50+ files, grouped by collections of endpoints. How would I combine these into a single JSON or YAML file that conforms to the spec so I can generate SDK for all endpoints at once?

Phytology answered 9/3, 2020 at 20:44 Comment(2)
Does this answer your question - How do I combine multiple OpenAPI 3 specification files together? That question is about OAS3 but the answers apply to OAS2 too.Concomitant
Didn't see that one while searching, but it doesn't look to be quite what I need. I have no $refs to resolve. Would I need to build one file what has $ref to pull in everything from each of the individual files?Phytology
T
1

https://github.com/iouring-engineering/openapi-merge

Checkout our open source tool which done using node. You can merge all your open api spec files using a json config

Torch answered 20/2 at 4:35 Comment(0)
F
0

You can use a python script to read the contents of each json file and append them to one single json file. Swagger will read each field and render the ui to display all of the files on a single page.

Fakery answered 22/2, 2022 at 17:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.