Documentation
¶
Overview ¶
Package specs provides OpenAPI registry utilities. EXPERIMENTAL: This package is not yet API-stable.
Index ¶
Constants ¶
const ( // Health check endpoints Livez = "/livez" Readyz = "/readyz" Healthz = "/healthz" Health = "/health" HealthDetailed = "/health/detailed" // Documentation endpoints Docs = "/docs" DocsOpenAPI = "/docs/openapi.json" DocsVersion = "/docs/version" DocsInfo = "/docs/info" // System endpoints Version = "/version" // Metrics endpoint (Prometheus) Metrics = "/metrics" // Pprof endpoints for runtime profiling. PprofIndex = "/debug/pprof/" PprofCmdline = "/debug/pprof/cmdline" PprofProfile = "/debug/pprof/profile" PprofSymbol = "/debug/pprof/symbol" PprofTrace = "/debug/pprof/trace" )
System endpoints for health checks and documentation
Variables ¶
var AllEndpoints = struct { Health interface{} Docs interface{} System interface{} }{ Health: HealthEndpoints, Docs: DocsEndpoints, System: SystemEndpoints, }
AllEndpoints groups all available endpoints
var DocsEndpoints = struct { Docs string OpenAPI string Version string Info string }{ Docs: Docs, OpenAPI: DocsOpenAPI, Version: DocsVersion, Info: DocsInfo, }
DocsEndpoints groups all documentation-related endpoints
var HealthEndpoints = struct { Livez string Readyz string Healthz string Health string HealthDetailed string }{ Livez: Livez, Readyz: Readyz, Healthz: Healthz, Health: Health, HealthDetailed: HealthDetailed, }
HealthEndpoints groups all health-related endpoints
var PprofEndpoints = struct { Index string Cmdline string Profile string Symbol string Trace string }{ Index: PprofIndex, Cmdline: PprofCmdline, Profile: PprofProfile, Symbol: PprofSymbol, Trace: PprofTrace, }
PprofEndpoints groups all profiling endpoints.
var SystemEndpoints = struct { Version string }{ Version: Version, }
SystemEndpoints groups all system-related endpoints
Functions ¶
This section is empty.
Types ¶
type Operation ¶
type Operation struct {
Method string
Path string
Summary string
Description string
Tags []string
Deprecated bool
RequestBody *RequestBody
Responses map[int]Response
}
Operation describes an API operation for registry usage.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry collects operations and produces a minimal OpenAPI document.
func NewRegistry ¶
NewRegistry constructs an OpenAPI registry with the provided info.
func (*Registry) SetServers ¶
SetServers replaces the server list.
type RegistryProvider ¶
type RegistryProvider struct {
// contains filtered or unexported fields
}
RegistryProvider adapts an OpenAPI registry to the DocsProvider interface.
func NewRegistryProvider ¶
func NewRegistryProvider(registry *Registry, info ports.DocsInfo, openAPIPath string) *RegistryProvider
NewRegistryProvider creates a DocsProvider backed by a registry.
func (*RegistryProvider) GetHTML ¶
func (p *RegistryProvider) GetHTML() (string, error)
GetHTML returns a basic Swagger UI page pointing at the registry OpenAPI JSON.
func (*RegistryProvider) GetInfo ¶
func (p *RegistryProvider) GetInfo() ports.DocsInfo
GetInfo returns the registry info.
func (*RegistryProvider) GetOpenAPI ¶
func (p *RegistryProvider) GetOpenAPI() ([]byte, error)
GetOpenAPI returns the JSON OpenAPI document from the registry.
func (*RegistryProvider) GetVersion ¶
func (p *RegistryProvider) GetVersion() (string, error)
GetVersion returns the registry version.
type RequestBody ¶
RequestBody describes request content metadata.