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 ./...`).
Click to show internal directories.
Click to hide internal directories.