schema

package
v1.42.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package schema holds the typed shapes that the cmd/* tools share. Manifest parsing lives here so cmd/gencreds and cmd/gentopology read the same struct definitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodePathSegment

func EncodePathSegment(segment string) string

EncodePathSegment percent-encodes a single URL path segment for inclusion in a NATS subject. Every byte outside [A-Za-z0-9-] becomes %XX (uppercase hex). Mirrors connector.escapePathPart. Wildcard sentinels are the caller's responsibility; this helper assumes a literal segment.

func FlattenHostname

func FlattenHostname(hostname string) string

FlattenHostname encodes a hostname for use as a single NATS subject segment. '.' becomes '_'; characters outside [A-Za-z0-9_-] are percent-encoded as %XX (uppercase hex). Mirrors connector.escapeHostname; output must be byte- identical so emitted ACL subjects match what the runtime publishes.

func ReverseHostname

func ReverseHostname(hostname string) string

ReverseHostname reverses dot-separated segments: www.example.com -> com.example.www.

Types

type Downstream

type Downstream struct {
	Hostname string `yaml:"hostname"`
	Package  string `yaml:"package,omitempty"`
}

Downstream is a service this one calls into via its *api Client. Only the hostname and package are recorded - the per-call endpoint set (route, method, hostname overrides) is derived from source by gencreds at deploy time, not stored in the manifest. This keeps callers' manifests stable across callee Def renames.

type EventSub

type EventSub struct {
	Package string `yaml:"package"`
}

EventSub captures the source of an inbound event subscription. The event name is the YAML map key (e.g. "OnOrderCreated"). The resolved hostname/route/method are intentionally omitted - they're derived from source by gencreds at deploy time.

type General

type General struct {
	Name     string `yaml:"name"`
	Hostname string `yaml:"hostname"`
	Package  string `yaml:"package"`
}

General is the manifest's identity block.

type Manifest

type Manifest struct {
	General        General             `yaml:"general"`
	Webs           map[string]Route    `yaml:"webs"`
	Functions      map[string]Route    `yaml:"functions"`
	Tasks          map[string]Route    `yaml:"tasks"`
	Workflows      map[string]Route    `yaml:"workflows"`
	OutboundEvents map[string]Route    `yaml:"outboundEvents"`
	InboundEvents  map[string]EventSub `yaml:"inboundEvents"`
	Downstream     []Downstream        `yaml:"downstream"`
}

Manifest is the subset of manifest.yaml that the cmd/* tools depend on. Fields not used by any tool are intentionally omitted; YAML unmarshal silently ignores unknown keys, so adding fields here is non-breaking.

func ReadManifest

func ReadManifest(path string) (*Manifest, error)

ReadManifest parses manifest.yaml from the given path.

func (*Manifest) ExposedRoutes

func (m *Manifest) ExposedRoutes() []Route

ExposedRoutes returns all caller-reachable routes (webs + functions + tasks + workflows).

type Route

type Route struct {
	Method string `yaml:"method"`
	Route  string `yaml:"route"`
}

Route is a registered endpoint on the bus.

Jump to

Keyboard shortcuts

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