Documentation
¶
Overview ¶
Package component defines the typed component manifest (PLUGIN-004): what a component provides, what it requires, and which events it emits and handles. The normalized typed model is authoritative; YAML and JSON are lossless interchange only, and validation fails at load time rather than at runtime.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BindingStrategy ¶
type BindingStrategy string
BindingStrategy describes how a component should be bound to capability providers when a runtime resolves its requirements.
const ( BindingStrategyDynamic BindingStrategy = "dynamic" BindingStrategyPerOp BindingStrategy = "per-operation" BindingStrategyPerReq BindingStrategy = "per-request" BindingStrategyPerTenant BindingStrategy = "per-tenant" BindingStrategyFixed BindingStrategy = "fixed" )
type ErrManifestInvalid ¶
ErrManifestInvalid is a typed validation failure carrying the key path, a human detail, and an optional "did you mean" suggestion.
func (*ErrManifestInvalid) Error ¶
func (e *ErrManifestInvalid) Error() string
type EventDecl ¶
type EventDecl struct {
Type string `yaml:"type" json:"type"`
Version int `yaml:"version" json:"version"`
}
EventDecl references one event envelope type and its schema version.
type EventTypeRegistry ¶
EventTypeRegistry reports whether an event envelope type is registered. Callers pass the canonical event registry; unknown types fail validation.
type EventsDecl ¶
type EventsDecl struct {
Emits []EventDecl `yaml:"emits" json:"emits,omitempty"`
Handles []EventDecl `yaml:"handles" json:"handles,omitempty"`
}
EventsDecl declares the event types a component emits and handles.
type Lifecycle ¶
type Lifecycle string
Lifecycle declares the expected runtime lifecycle posture for the component.
type Manifest ¶
type Manifest struct {
Name string `yaml:"name" json:"name"`
Version string `yaml:"version" json:"version"`
Runtime Runtime `yaml:"runtime" json:"runtime"`
BindingStrategy BindingStrategy `yaml:"binding_strategy,omitempty" json:"binding_strategy,omitempty"`
Lifecycle Lifecycle `yaml:"lifecycle,omitempty" json:"lifecycle,omitempty"`
Provides []string `yaml:"provides" json:"provides,omitempty"`
Requires []string `yaml:"requires" json:"requires,omitempty"`
Events EventsDecl `yaml:"events" json:"events,omitempty"`
}
Manifest is the typed component definition.
func LoadJSON ¶
func LoadJSON(data []byte, events EventTypeRegistry) (*Manifest, error)
LoadJSON decodes a JSON manifest strictly (unknown fields rejected) and validates it. It returns a typed *ErrManifestInvalid for unknown keys or semantic validation failures.
func LoadYAML ¶
func LoadYAML(data []byte, events EventTypeRegistry) (*Manifest, error)
LoadYAML decodes a YAML manifest strictly and validates it. YAML is interchange only; the typed Manifest is authoritative.
func (Manifest) Validate ¶
func (m Manifest) Validate(events EventTypeRegistry) error
Validate checks name, version, runtime, capability duplicates, and event types. It returns the first failure as a typed *ErrManifestInvalid.