reveal is a statical analysis tool for Go codebases that aims at extracting valuable information before runtime.
- Generates OpenAPI 3.0 schemas from Gin source code
go run . ./tests/gin-json | tee /tmp/openapi.json
redoc-cli serve -w /tmp/openapi.json # npm i -g redoc-cli
reveal uses golang.org/x/tools/go/packages to statically parse and resolve types for the packages provided to this tool. So it uses the same base implementation as the Go compiler. Because we are not doing this a runtime, some information might not be available (e.g.: conditionnal routes based on runtime parameters). Multiple HTTP servers from the same service will also be merged into a single OpenAPI schema.