commands

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDoctorCommand

func NewDoctorCommand() *cobra.Command

NewDoctorCommand creates the doctor command

func NewGenerateCommand

func NewGenerateCommand() *cobra.Command

NewGenerateCommand creates the generate command

func NewValidateCommand

func NewValidateCommand() *cobra.Command

NewValidateCommand creates the validate command, which checks that an existing OpenAPI document (YAML or JSON) is structurally valid OpenAPI 3.0. It is the user-facing surface of the in-process validator that also backs the generator's --validate flag.

This validates the *document* only. Runtime request/response validation is out of scope.

func NewVersionCommand

func NewVersionCommand(version string) *cobra.Command

NewVersionCommand creates the version command

func ResolveVersion

func ResolveVersion(injected string) string

ResolveVersion picks the most authoritative version string available. Precedence: an ldflags-injected build version (GoReleaser / `make build`) wins; otherwise the main module version recorded by `go install`; otherwise the "dev" sentinel. injected is main.version, which defaults to "dev".

Pseudo-versions (e.g. "v0.0.0-20230101000000-abcdef123456") from a commit-pinned `go install` are treated as usable and returned as-is — they are the correct version for that build.

Types

type DoctorOptions

type DoctorOptions struct {
	ProjectRoot string
	Verbose     bool
	GoVersion   string
}

DoctorOptions holds options for the doctor command

type GenerateOptions

type GenerateOptions struct {
	ProjectRoot string
	OutputFile  string
	Verbose     bool

	// Document metadata (override the analyzer defaults).
	Title       string
	APIVersion  string
	Description string
	Servers     []string
	License     string
	LicenseURL  string

	Format            string // "yaml" (default) or "json"
	DisableTenantAuth bool   // omit the X-Tenant-ID security scheme (single-tenant)
	TenantHeader      string // header name for the tenant security scheme (default X-Tenant-ID)
	Strict            bool   // treat warnings (empty/untyped) as a non-zero exit
	Validate          bool   // validate the generated spec (OpenAPI 3.0) before writing
}

GenerateOptions holds options for the generate command

type ProjectStats

type ProjectStats struct {
	ModuleCount         int
	RouteCount          int
	TypedRoutes         int
	TypedRequestRoutes  int
	TypedResponseRoutes int
	UntypedRoutes       []string // Handler names of untyped routes
}

ProjectStats holds project analysis statistics

Jump to

Keyboard shortcuts

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