Documentation
¶
Overview ¶
Package baseresource declares the "Radius-aware" properties (application, environment, connections, codeReference) that every resource type schema inherits, and merges them into per-type schemas.
The properties are declared once in base.yaml, embedded into the binary, and applied to each schema by Apply(). Inheritance is implicit: a resource type author writes only type-specific properties, and the common properties are merged in before validation and registration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RawManifest ¶
func RawManifest() []byte
RawManifest returns a copy of the embedded canonical base resource manifest YAML. It lets other packages — for example bicep-tools, which models schemas with its own types — decode the base property set from the same source of truth instead of duplicating the definitions.
Types ¶
type BaseManifest ¶
type BaseManifest struct {
// contains filtered or unexported fields
}
BaseManifest is the in-memory, immutable representation of the embedded base resource manifest. Construct it once at service/command initialization with Load (or MustLoad) and reuse it for the lifetime of the process — its contents never change after construction.
func Load ¶
func Load() (*BaseManifest, error)
Load parses the embedded base.yaml into an immutable BaseManifest. The schema map it produces uses the same Go types (map[string]any, []any) that the manifest decoder produces for per-type schemas, so Apply is type-consistent.
Callers should invoke Load once, at initialization, and hold the result.
func MustLoad ¶
func MustLoad() *BaseManifest
MustLoad is like Load but panics if the embedded base manifest cannot be parsed. The embedded manifest is a build-time constant validated by tests, so a failure indicates a programming error and should fail fast at startup. It is intended for package-level initialization (var base = MustLoad()).
func (*BaseManifest) Apply ¶
func (b *BaseManifest) Apply(schema map[string]any) error
Apply merges the common base properties into the given resource type schema.
For every base property absent from the schema it copies the base definition in (per-type-wins precedence: an author's own declaration is never overwritten). It then unions the base "required" list into the schema's "required" list so mandatory common properties stay mandatory.
Apply mutates schema in place. It is purely lexical — no network, file, or UCP access — and idempotent: applying it more than once yields the same result. A nil schema is a no-op.
func (*BaseManifest) PropertyNames ¶
func (b *BaseManifest) PropertyNames() []string
PropertyNames returns the names of the common base properties, sorted.
func (*BaseManifest) RequiredNames ¶
func (b *BaseManifest) RequiredNames() []string
RequiredNames returns the names of the base properties that are mandatory on every resource type, sorted.