-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Suggested by @ncreep:
Something along these lines http://azimi.me/2015/07/16/split-swagger-into-smaller-files.html it should be simple to add, since we just need to get the description base-paths from each of the other modules and use them to generate the composite JSON doc.
I'm envisaging that you've got a few modules sitting at various contexts, then a fallback root module with the composite renderer. Is that what you had in mind? So along the lines of:
/context1/swagger.json
/context2/swagger.json
/swagger.json <-- composite with $refs
The trickiest part is getting the API to look nice. Easiest option would probably be to have a CompositeModule function which takes a bunch of other modules or creates them in a builder like way (see below):
CompositeModule(Root, CompositeRenderer)
.withModules(m1, m2, m3)
However, since the Module is not typed by the Renderer implementation, it would currently not be possible to have the compiler guarantee that all of the submodules were in fact Swagger modules, so an alternative is to have the "super" module create the submodules and pass them to a function for configuration:
val m: Module = SwaggerCompositeModule(Root)
.withModule(_ / "context", {
module =>
module.withRoute(r1).withRoute(r2)
})