less than 1 minute read

Unfortunately Azure API Management doesn’t support swagger files which use a $ref pointer to reference external files source. Which means to import them I’ll have to manually go through and copy the relevant parts in. Unfortunately the API that I’m working with uses $ref a lot.

Thankfully, I found Swagger Merger to save me manually copying and pasting accross files!

To install it, use the following.

npm i -g swagger-merger

To merge your multiple files, specify your input with -i and the merged file with -o. It will grab the external $ref links, download theme and replace the section as required.

swagger-merger -i swagger.json -o swagger-merged.json
If you found this content helpful, please consider sponsoring me on GitHub or alternatively buying me a coffee