I have multiple API's I'm writing in GoLang. Let's say I have one for Books and another for Customers. I have the standard REST endpoints for both and am using go-swagger to generate a swagger.json
file. I end up with one json for Books and another for Customers. I'm able to serve these individually but how do I merge the two jsons into one so that I can serve one file and have Swagger documentation for both Books and Customers in one place?
One approach was to convert Books and Customers to exportable libraries and then have another main.go
in the root directory that imports and uses those libraries, but I don't really like this hacky way. Is there a way to merge multiple individual swagger jsons?
I tried using the -i
flag mentioned here https://goswagger.io/use/spec.html but that didn't work correctly.