OPENAPI FOR GO
Build OpenAPI 3.x specs in pure Go. No annotations, no code comments. Test-driven, always in sync with what your API actually does.
package main import ( "github.com/oaswrap/spec" "github.com/oaswrap/spec/option" ) func main() { r := spec.NewRouter( option.WithTitle("My API"), option.WithVersion("1.0.0"), ) r.Get("/users/{id}", option.Summary("Get user"), option.Response(200, new(User)), ) // Write spec to file r.WriteSchemaTo("openapi.yaml") }
ECOSYSTEM
specOpenAPI builder
Build OpenAPI 3.x and 3.2 specs in pure Go. Code-first, type-safe, 9 framework adapters.
View docs →gswagTest-driven docs
Generate specs as a side-effect of Ginkgo integration tests. Zero drift guaranteed.
View docs →spec-uiDocumentation UIs
Swagger UI, Stoplight, ReDoc, Scalar, or RapiDoc. Switch with a single import.
View docs →CAPABILITIES
Everything you need to ship accurate API docs.
Build OpenAPI 3.x and 3.2 specs in pure Go with full type safety. chi, gin, echo, fiber, iris, net/http, gorilla/mux — or standalone for CI/CD.
Learn more →Generate specs as a side-effect of your Ginkgo integration tests. Real HTTP requests mean zero drift.
Learn more →Swagger UI, Stoplight, ReDoc, Scalar, or RapiDoc. Switch providers by changing a single import. CDN or air-gapped.
Learn more →Error, Warning, and Info severity levels. Catch missing fields, invalid references, and best-practice violations before deployment.
Learn more →QUICK START
From zero to a working OpenAPI spec in three steps.
go get github.com/oaswrap/spec
No code generation. No annotations.
r := spec.NewRouter(
option.WithTitle("My API"),
)
r.Get("/users/{id}",
option.Response(200, new(User)),
)Works with chi, gin, echo, fiber, net/http.
r.WriteSchemaTo("openapi.yaml")CI-ready. Plug into any UI provider.
Zero annotations. Zero drift. Just Go code and tests that already exist.