Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Composite Swagger modules #43

Open
daviddenton opened this issue May 17, 2017 · 0 comments
Open

Add support for Composite Swagger modules #43

daviddenton opened this issue May 17, 2017 · 0 comments

Comments

@daviddenton
Copy link
Owner

Suggested by @ncreep:

Something along these lines https://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)
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant