wirespec

package
v0.4.21 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package wirespec is the single source of truth for subflux's HTTP wire contract: the registered wire types, enums, and the endpoint table that cmd/wire-codegen feeds into wiregen to emit the TS types, decoders, typed client, and the Go path constants (internal/apipaths).

routes.go (internal/server) stays authoritative for PERMISSIONS — each endpoint's AuthGroup here is checked against the actual route registration by internal/server's wirespec consistency test, so the two tables cannot drift silently.

wiregen is a build-time-only dependency: this package is imported by cmd/wire-codegen and by tests, never by the server runtime.

The Unix-socket admin plane (POST /api/admin/bootstrap, served via server.AdminHandler on config.AdminSocketPath) is DELIBERATELY off this table: it is not part of the TCP wire contract, has no browser consumer, and its path constant is hand-written in internal/config so the CLI's socket client and main.go share it without generated code.

Index

Constants

View Source
const (
	GroupPublic          = "public"
	GroupUser            = "user"
	GroupAdmin           = "admin"
	GroupUserConfigured  = "userConfigured"
	GroupAdminConfigured = "adminConfigured"
)

Auth group tags. Values match the route group names in internal/server/routes.go; the consistency test compares them.

Variables

This section is empty.

Functions

func Endpoints

func Endpoints() []wiregen.Endpoint

Endpoints returns the endpoint table: every HTTP route the server registers, in routes.go registration order. AuthGroup mirrors the route group; Kind marks the documented non-JSON flows (raw) and the SSE stream.

func Registry

func Registry() *wiregen.Registry

Registry returns the fully-populated wiregen registry: types, enums, name overrides, and the endpoint table.

func RoutePatterns

func RoutePatterns() map[string]string

RoutePatterns is reached only by tests, which is this package's whole shape: wirespec is build-time-only, imported by cmd/wire-codegen and by the consistency test that compares this table against routes.go bidirectionally.

RoutePatterns maps endpoint names to their routes.go registration pattern when it differs from the default "METHOD path". Covers the prefix-style registrations (Go 1.22 ServeMux trailing-slash patterns whose handlers parse the suffix themselves) and the deliberately method-less routes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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