spec

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPath is the canonical generated OpenAPI output location.
	DefaultPath = "openapi/compozy.json"
)
View Source
const RequestUploadForm = "multipart/form-data"

RequestUploadForm documents a multipart upload carrying one required binary "file" field.

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 AppAccess

type AppAccess string

AppAccess is an explicit local-browser authorization decision.

const (
	AppAccessAllowed AppAccess = "allowed"
	AppAccessDenied  AppAccess = "denied"
)

type OperationAuth

type OperationAuth string

OperationAuth identifies the transport-owned trust boundary for an operation.

const (
	OperationAuthDevice         OperationAuth = "device"
	OperationAuthLocalSocket    OperationAuth = "local_socket"
	OperationAuthPrivatePreAuth OperationAuth = "private_pre_auth"
)

type OperationSpec

type OperationSpec struct {
	AppAccess   AppAccess
	Stream      string
	Stability   string
	Method      string
	Path        string
	OperationID string
	Summary     string
	Tags        []string
	Transports  []Transport
	Auth        map[Transport]OperationAuth
	Parameters  []ParameterSpec
	RequestBody any
	// RequestBodyOptional keeps a request body schema documented while allowing empty requests.
	RequestBodyOptional bool
	// RequestContentType overrides the request media type; an empty value uses application/json when RequestBody is set.
	// RequestUploadForm is the only non-JSON value accepted today.
	RequestContentType string
	Responses          []ResponseSpec
}

OperationSpec describes one canonical REST operation.

func Operations

func Operations() []OperationSpec

Operations returns the complete transport-neutral operation registry.

type ParameterSpec

type ParameterSpec struct {
	Name        string
	In          string
	Description string
	Required    bool
	Kind        string
	Format      string
	Enum        []string
	Pattern     string
	MaxLength   *uint64
	Minimum     *float64
	Maximum     *float64
	Default     any
}

ParameterSpec describes one OpenAPI parameter.

type ResponseSpec

type ResponseSpec struct {
	Status            int
	Default           bool
	Description       string
	Body              any
	Bodies            responseBodies
	ContentType       string
	AdditionalContent map[string]any
	Headers           map[string]ParameterSpec
}

ResponseSpec describes one OpenAPI response.

func (ResponseSpec) BodyTypes

func (response ResponseSpec) BodyTypes() []reflect.Type

BodyTypes returns independent type descriptors for the primary response media type.

type Transport

type Transport string

Transport identifies which daemon transport exposes a route.

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

Source Files

Jump to

Keyboard shortcuts

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