spec

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPath is the canonical generated OpenAPI output location.
	DefaultPath = "openapi/agh.json"
)

Variables

This section is empty.

Functions

func Document

func Document() (*openapi3.T, error)

Document builds the canonical OpenAPI specification document.

func Render

func Render() ([]byte, error)

Render renders the canonical OpenAPI document as deterministic JSON bytes.

func WriteFile

func WriteFile(path string) error

WriteFile renders the canonical OpenAPI document to the supplied path.

Types

type OperationSpec

type OperationSpec struct {
	Method      string
	Path        string
	OperationID string
	Summary     string
	Tags        []string
	Transports  []Transport
	Parameters  []ParameterSpec
	RequestBody any
	// RequestBodyOptional keeps a request body schema documented while allowing empty requests.
	RequestBodyOptional bool
	Responses           []ResponseSpec
}

OperationSpec describes one canonical REST operation.

func Operations

func Operations() []OperationSpec

type ParameterSpec

type ParameterSpec struct {
	Name        string
	In          string
	Description string
	Required    bool
	Kind        string
	Format      string
	Enum        []string
}

ParameterSpec describes one OpenAPI parameter.

type ResponseSpec

type ResponseSpec struct {
	Status      int
	Description string
	Body        any
	ContentType string
}

ResponseSpec describes one OpenAPI response.

type Transport

type Transport string

Transport identifies which daemon transport exposes a route.

const (
	TransportHTTP Transport = "http"
	TransportUDS  Transport = "uds"
)

Jump to

Keyboard shortcuts

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