r/golang•
Growlizing

Auto-generated API docs?

I come from java and have long used Swagger for automatically generating api documentation based on the built code. I have tried something similar in Go about two years ago, and it was actually a major pain point.

Just wanted to ask if anyone here knows about new tools for this?

Posted Oct 23, 2016, 12:36 PM UTC

1411
UnknownTed•

https://goa.design/

https://stoplight.io/ (not Go, just a swagger editor)

4
gogroob•

I've used https://github.com/adams-sarah/test2doc and been mostly happy with the result. I have a large table test for all my API endpoints, and after it runs, I get an up to date api doc.

The templates used in the project are specific to apiary, but could be re-written for swagger.

3
kpurdon•

https://github.com/go-swagger/go-swagger or if you want to try a different approach (that also results in swagger specs) take a look at https://goa.design

2
thewhitetulip•

Just curious, doesn't the official docs serve us here? the godoc tool, which parses all the code in $GOPATH and serves html via a server?

EDIT: downvoters, pls explain my doubt, I think it is a stupid doubt since you are downvoting.

2
dlq84•

godoc documents code, swagger documents web-apis

1
rondr•

Apiary does a good job

1
0x4445565A•

I too would like to know about this, could be very useful. How hands off was Swagger? Did it just look at your code and know or did you have to list all of your endpoints?

1
GrowlizingOP•

In java, I only had to annotate the http handlers so it knew which classes to scan, and automatically generates docs for the available API and all its urls with request and response types.

1
mixedCase_•

I've used this in the past and it was a little buggy but got the job done. It's been a long time though and it has received some activity since then.

Do try it out if you're coming from Swagger.

1
TheSpreader•

I've been using go-restful for a while now, it can generate swagger documentation but you still have to do some configuration of each endpoint to get it to document correctly. But it's not a standalone swagger documenter, it only documents endpoints that are exposed via go-restful.

1
[deleted]•

[deleted]

0
GrowlizingOP•

I am not thinking of documentation of code, but automatic documentation of your apps public web api!

2