Documentation
¶
Overview ¶
Package blocktypes assigns ordinary Blocks generated symbols from the resolved manifest. It does not replace persisted field identities or intern schemas.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Identifier ¶
Identifier derives a portable name from a resolved slug or field path.
Types ¶
type Catalog ¶
type Catalog struct {
// Fields indexes containers by the field IDs a definition traversal sees:
// a resource's own fields by their stable IDs, and fields of blocks by
// their definition-relative IDs. Generators therefore traverse blocks
// through Definitions or a Variant's Block.
Fields map[schema.StableID]Field
Variants []Variant
}
Catalog is a deterministic, generation-local index into resolved schemas. It is built from definitions: each block is cataloged once, not once per placement.
func Build ¶
Build validates naming and reuse without mutating the manifest. Labels and presentation metadata never participate in a block's resolved shape. Each definition is cataloged once per locale context, so the work is proportional to definitions, not to every path through the block graph. A variant is named by its definition's TypeName, or the slug in PascalCase, never by a placement.
func (*Catalog) DraftReadFields ¶ added in v0.14.0
DraftReadFields identifies authored fields that may be incomplete in a read, by the field IDs a definition traversal sees (see Catalog.Fields). Reused block families inherit this from every owning resource: a single named output type must describe both its published and unfinished occurrences.
type Field ¶
type Field struct {
Embedded bool
Name string
Discriminator string
Identity string
Variants []string
}
Field describes a named block container at an existing stable field identity.
type Shaper ¶ added in v0.15.0
type Shaper struct {
// contains filtered or unexported fields
}
Shaper computes resolved block shapes, remembering each block's shape so a definition placed many times is encoded once.
func NewShaper ¶ added in v0.15.0
func NewShaper() *Shaper
NewShaper returns an empty shape memo. A Shaper is not safe for concurrent use.
func (*Shaper) Shape ¶ added in v0.15.0
Shape compares resolved value contracts, excluding placement and author-facing metadata. It deliberately retains defaults, validation and reference targets. Nested block types contribute their type name, discriminator and a digest of their own shape, so each block is encoded once however often it is nested.