golang

package
v1.9.12 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGenerator

func NewGenerator() generators.LanguageGenerator

NewGenerator creates a new Go generator.

Types

type CapabilitiesGenerator added in v1.9.8

type CapabilitiesGenerator struct{}

CapabilitiesGenerator emits capabilities.go: the scopes, roles and permissions this API's routes declare, as string-typed unions, plus a client-held Principal and the predicates an interface uses to decide what to render.

TypeScript has carried the scope half of this (capabilities.ts) since before roles and permissions existed in the IR at all. This is the Go generator's first version of the same idea, and it covers all three kinds from the start rather than leaving roles and permissions for later.

What it is NOT is stated at the top of the generated file rather than only here, because the generated file is what somebody reads at the call site: every answer it gives is computed from client-held state and is never an authorization decision.

func NewCapabilitiesGenerator added in v1.9.8

func NewCapabilitiesGenerator() *CapabilitiesGenerator

NewCapabilitiesGenerator creates a new capabilities generator.

func (*CapabilitiesGenerator) Generate added in v1.9.8

func (g *CapabilitiesGenerator) Generate(spec *client.APISpec, config client.GeneratorConfig) (string, []string)

Generate produces capabilities.go, plus any warnings raised while resolving collected scopes, roles or permissions into Go identifiers (see resolveCapabilityConsts). Callers must check capabilitiesNeeded first; this does not gate itself and will happily emit three empty unions for a spec that declares nothing.

type ErrorGenerator added in v0.5.0

type ErrorGenerator struct{}

ErrorGenerator generates Go error types.

func NewErrorGenerator added in v0.5.0

func NewErrorGenerator() *ErrorGenerator

NewErrorGenerator creates a new error generator.

func (*ErrorGenerator) Generate added in v0.5.0

func (e *ErrorGenerator) Generate(spec *client.APISpec, config client.GeneratorConfig) string

Generate generates error types for Go.

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator generates Go clients.

func (*Generator) Generate

Generate generates the Go client.

func (*Generator) Name

func (g *Generator) Name() string

Name returns the generator name.

func (*Generator) SupportedFeatures

func (g *Generator) SupportedFeatures() []string

SupportedFeatures returns supported features.

func (*Generator) Validate

func (g *Generator) Validate(specIface generators.APISpec) error

Validate validates the spec for Go generation.

type PaginationGenerator added in v0.5.0

type PaginationGenerator struct{}

PaginationGenerator generates pagination helpers for Go.

func NewPaginationGenerator added in v0.5.0

func NewPaginationGenerator() *PaginationGenerator

NewPaginationGenerator creates a new pagination generator.

func (*PaginationGenerator) Generate added in v0.5.0

func (p *PaginationGenerator) Generate(spec *client.APISpec, config client.GeneratorConfig) string

Generate generates pagination helper code.

type RESTGenerator

type RESTGenerator struct {
	// contains filtered or unexported fields
}

RESTGenerator generates REST client code.

func NewRESTGenerator

func NewRESTGenerator() *RESTGenerator

NewRESTGenerator creates a new REST generator.

func (*RESTGenerator) Generate

func (r *RESTGenerator) Generate(spec *client.APISpec, config client.GeneratorConfig) string

Generate generates the rest.go file.

type SSEGenerator

type SSEGenerator struct {
	// contains filtered or unexported fields
}

SSEGenerator generates SSE (Server-Sent Events) client code.

func NewSSEGenerator

func NewSSEGenerator() *SSEGenerator

NewSSEGenerator creates a new SSE generator.

func (*SSEGenerator) Generate

func (s *SSEGenerator) Generate(spec *client.APISpec, config client.GeneratorConfig) string

Generate generates the sse.go file.

type StreamingGenerator added in v1.9.8

type StreamingGenerator struct{}

StreamingGenerator emits streaming.go: the declarations that more than one streaming transport's file refers to but none of them owns.

ConnectionState and the reconnect-backoff helpers used to be emitted by websocket.go, which sse.go then referred to. That compiled only for a spec carrying both transports: generator.go emits websocket.go only when the spec declares a WebSocket endpoint, so an API that streams over SSE alone produced a client whose sse.go named half a dozen identifiers nothing declared. Hoisting them here decides the question once -- these belong to the package, not to whichever transport happened to be emitted first -- rather than leaving each file to borrow from a neighbour that may not be there.

func NewStreamingGenerator added in v1.9.8

func NewStreamingGenerator() *StreamingGenerator

NewStreamingGenerator creates a new shared streaming generator.

func (*StreamingGenerator) Generate added in v1.9.8

func (s *StreamingGenerator) Generate(config client.GeneratorConfig) string

Generate generates the streaming.go file. It takes no spec: nothing it emits varies with the endpoints, only with the features that gate which declarations the transport files will reach for.

type TypesGenerator

type TypesGenerator struct{}

TypesGenerator generates Go type definitions.

func NewTypesGenerator

func NewTypesGenerator() *TypesGenerator

NewTypesGenerator creates a new types generator.

func (*TypesGenerator) Generate

func (t *TypesGenerator) Generate(spec *client.APISpec, config client.GeneratorConfig) string

Generate generates the types.go file.

type WebSocketGenerator

type WebSocketGenerator struct {
	// contains filtered or unexported fields
}

WebSocketGenerator generates WebSocket client code.

func NewWebSocketGenerator

func NewWebSocketGenerator() *WebSocketGenerator

NewWebSocketGenerator creates a new WebSocket generator.

func (*WebSocketGenerator) Generate

func (w *WebSocketGenerator) Generate(spec *client.APISpec, config client.GeneratorConfig) string

Generate generates the websocket.go file.

type WebTransportGenerator

type WebTransportGenerator struct{}

WebTransportGenerator generates Go WebTransport client code.

func NewWebTransportGenerator

func NewWebTransportGenerator() *WebTransportGenerator

NewWebTransportGenerator creates a new WebTransport generator.

func (*WebTransportGenerator) Generate

func (w *WebTransportGenerator) Generate(spec *client.APISpec, config client.GeneratorConfig) string

Generate generates the WebTransport clients.

Jump to

Keyboard shortcuts

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