I have been using Roda for some micro services for awhile now, and absolutely love it. I have done some integration using the
swagger-blocks gem to document the request and response bodies of various REST API endpoints. What I have put together for my services works, but would love to formalize it a bit and make a plugin for it.
I was thinking of extending off of the current
list-routes plugin to build up the swagger endpoints list. However, I would need to add two things to that parser so that I could know the request body DTO object and response body DTO object (if applicable).
Currently, that guy looks for comments in the routes like this => # route: GET|POST /path/to/foo/:foo_id
I would need to modify it to do something like # route: GET|POST /path/to/foo/:foo_id request: Path::To::DTO::Class response: Path::To::Class
Then the parse action could build up the metadata routes and also parse out the request and response bodies so we know what the "contract" looks like for the endpoint. The only other minimum thing needed would be an ability to describe HTTP status codes coming back. That would be a barebones implementation. Obviously, a complete solution would have security/authentication information, description that could be entered for swagger, etc, etc. So, there is a balance to where its starting to be too much to handle just using inline comments. :) I have thought about using a yaml file to handle these route properties instead of inline, but that gets messy linking the two together.
Any thoughts out there on the best way to approach this? Also, is it possible to create a plugin that depends on another plugin? Or is it best to just fork the existing plugin and add extra functionality to the existing one? Would anyone have interest in this? Is there a gem that is doing this (in an automated way) that I missed?
Sorry for all the questions, I am kind of a noob in terms of contributing. I have some time over the next few weeks, and would love to figure out a way to contribute to this great tool.
Thanks!
J