Skip to main content

OPENAPI FOR GO

Framework-agnostic
API docs.

Build OpenAPI 3.x specs in pure Go. No annotations, no code comments. Test-driven, always in sync with what your API actually does.

main.go
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")
}
01

Code-first spec generation

Build OpenAPI 3.x specs in pure Go with full type safety. Works with any framework or standalone for CI/CD pipelines.

02

Test-driven documentation

Generate specs as a side-effect of your Ginkgo integration tests. Real HTTP requests mean zero drift.

03

Multiple UI providers

Swagger UI, Stoplight, ReDoc, Scalar, or RapiDoc. Switch providers by changing a single import. CDN or air-gapped.

© 2026 OASWrap — built with Docusaurus