Need help with go-httpdoc?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

218 Stars 11 Forks MIT License 54 Commits 2 Opened issues


Golang package for generating API documentation from httptest. See example output

Services available


Need anything else?

Contributors list

go-httpdoc Go Documentation

is a Golang package to generate API documentation from
test cases.

It provides a simple http middleware which records http requests and responses from tests and generates documentation automatically in markdown format. See Sample Documentation. It also provides a way to validate values are equal to what you expect with annotation (e.g., you can add a description for headers, params or response fields). If you write proper tests, it will generate usable documentation (namely, it forces you to write good tests).

Not only JSON request and response but it also supports protocol buffer. See Sample ProtoBuf Documentation).

See usage and example in GoDoc.

NOTE: This package is experimental and may make backward-incompatible changes.


go-httpdoc requires Go 1.7 or later.


Use go get:

$ go get -u


All usage are described in GoDoc.

To generate documentation, set the following env var:

$ export HTTPDOC=1


The original idea came from r7kamura/autodoc (rack middleware).

For struct inspection in validator, it uses tenntenn/gpath package.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.