openapi-gen

command
v0.35.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Command openapi-gen generates runtime/internal/openapidocs/openapi.json from the HTTP route registrations and the inline annotations in the route packages.

Conventions consumed:

mux.HandleFunc("GET /backends/{id}", h.get)   // route -> handler method
... // @request  pkg.RequestType                (inside the handler body)
... // @response pkg.ResponseType
... // @param    name type                      (path param if {name} in route, else query)
Field T `json:"x" openapi_include_type:"pkg.Type"`  // document a named type

Request/response/param types are resolved to JSON Schema by walking the struct definitions found in the scanned packages; types that cannot be resolved degrade to a generic object schema rather than failing.

Run from the repo root: `go run ./tools/openapi-gen` (or `go generate ./...`).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL