-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
discussion: swagger support #27
Comments
Hi Am,
It looks nice!
No
No
Concluding from the previous answers: No
Indeed. I'd prefer to keep the nodes lightweight.
It is! I think it would be a very nice add-on. Not only to HttpRouter, it would be useful with (almost) any router. On the other side, I want to keep this router as simple as possible. Therefore including native support is not really an option. The best solution to me would be 3rd-party package like your current swugger project. |
Hey there, sorry for the extremely delayed response, and thanks for responding & offering a solution. Yes I like the idea of registering a 'handler' which receives routing information, but, I think the routing information would be missing docs & input/output parameters - an important part of Swagger. I guess this could be passed in as a 'metadata' parameter (containing the method docs plus parameter specs). At a guess I'd say that this metadata object would only be interesting to Swagger users (i.e. just a fraction of httprouter's audience), so it might not make sense to add the metadata to your API. So, I think a Swugger-like wrapper would still be needed in combination with this handler concept. The information I'd hope for a route handler to receive would be:
It might be worth checking out the Swagger docs for further details. Otherwise, just ask |
@laher not sure if this is useful, but I maintain a package that plugs RAML into your router of choice with examples for httprouter: https://github.com/EconomistDigitalSolutions/ramlapi |
there are still no changes here? |
I commented a basic solution here using swag annotations (dev dependency, not runtime) and just static serving a folder containing No runtime dependencies or changes needed to httprouter |
Hi Julien,
I just set up a project called Swugger to show how swagger support might be acheived for httprouter. It's working, and it uses go-restful's swagger support to document some 'dummy' go-restful routes while setting up real routes in httprouter. I'd like to actually just fork go-restful and strip it back into a swagger provider for httprouter (and others), but before I do that I'd like to check in with you first.
So, I have 2 questions:
Firstly, have you considered Swagger support already? Or any other form of service description feature? Are you already working on something like this for httprouter? For example, it might be nice to optionally represent routing documentation inside httprouter's
node
, but then on the other hand, it would add baggage to a small and tidy framework.Secondly, if you're interested at all, could you take a look at swugger (see the readme), and see if it's an interesting idea to you. If you have any feelings about how you might do things differently, I'd love to know.
Feedback aside I'll just go ahead and make a less 'ugger' version of swugger (forking and stripping back go-restful back towards swagger support only. I may also change it to use a less fluent-interface style of library - just adding a RouteDoc{} struct to each route definition might feel more Go-ish to me).
Anyway, there it is, thanks for the awesome work on making a fast router.
The text was updated successfully, but these errors were encountered: