Merging Swagger Definitions
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
Comments