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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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