Skip to main content

Module schema

Module schema 

Source
Expand description

Recursive in-memory mirror of the golem:core@2.0.0 schema model.

Modules§

canonical
Canonical text and JSON encodings for the rich scalar and capability payloads of super::SchemaValue.
conversion
Runtime trait surface for converting Rust values to and from the recursive schema model.
derive
Private re-exports used by code emitted by the IntoSchema / FromSchema derive macros in the golem-schema-derive crate.
fingerprint
graph
host_managed
Closed classification of host-managed capability nodes and the shared redaction helpers that observability surfaces consult.
metadata
multimodal
Detectors for the canonical multimodal schema shape list<variant<… Role::Multimodal>>.
render
Guest-safe canonical schema and value rendering.
schema_type
schema_value
stream
Affine native streams carried recursively by super::SchemaValue.
tool
Native, serializable data model for golem:tool/common@0.1.0 tool metadata.
unstructured
Canonical “unstructured” text/binary carriers.
validation
Validation utilities for the in-memory schema model.
wit
Round-trip conversion between the recursive in-memory schema model in super and the flat, index-based wire types from the golem:core@2.0.0 WIT package.

Structs§

BinaryRestrictions
BinaryValuePayload
DurationValuePayload
Signed duration as total nanoseconds.
FieldDiscriminator
HostManagedOccurrence
The first host-managed capability reached while traversing a schema type or value tree.
MetadataEnvelope
Typed metadata envelope. Holds non-validation, non-rendering-critical information (docs, aliases, examples, deprecation, role). Per-scalar validation constraints live on the relevant scalar’s typed substructure, not here.
NamedFieldType
PathSpec
PermissionCardSpec
Spec for a SchemaType::PermissionCard capability node.
PermissionCardValuePayload
Capability value: the trusted internal/persistent representation of a permission-card, held only inside SchemaValue::PermissionCard. Across a WIT boundary the card travels as an opaque, unforgeable owned handle (permission-card-handle(own<permission-card>)); the host converts between this snapshot and a handle through a resolver and the receiver re-acquires the live card against card_id on demand. This snapshot is never exposed to or constructible by a guest.
Quantity
A fixed-point decimal value with a unit, constrained by the QuantityUnit marker U. Encodes to the rich SchemaValue::Quantity.
QuantitySpec
QuantityValue
Fixed-point decimal value with unit: numeric value = mantissa * 10^(-scale). unit is a free-form string at the value level; the schema’s QuantitySpec constrains the accepted set.
QuotaTokenSpec
QuotaTokenValuePayload
Capability value: the trusted internal/persistent representation of a quota-token, held only inside SchemaValue::QuotaToken. Across a WIT boundary the token travels as an opaque, unforgeable owned handle (quota-token-handle(own<quota-token>)); the host converts between this snapshot and a handle through a resolver and the receiver re-acquires a live lease against (environment_id, resource_name) on demand. This snapshot is never exposed to or constructible by a guest.
RedactedSchemaValue
Wraps a SchemaValue so its Debug output redacts every host-managed capability node (see HostManagedKind).
ResultSpec
SchemaBuilder
Mutable working set used while a graph is being built up.
SchemaFingerprintV1
BLAKE3-256 digest of the v1 deterministic-CBOR encoding of a stream element schema closure.
SchemaGraph
A self-contained schema graph in the recursive in-memory form.
SchemaTypeDef
A named type definition inside a SchemaGraph.
SchemaValueStream
Guest-side stream leaf. A leaf can hold the recursive WIT resource or the native reader obtained from it. Clones share one take-once state.
SecretSpec
SecretValuePayload
Capability value: the trusted host snapshot of a secret handle.
TextRestrictions
TextValuePayload
TypeId
Stable, language-independent identifier for a named type definition. Must be unique within the enclosing super::SchemaGraph. Conventional format is a dot-separated namespace path (e.g., "myapp.users.user"). Each SDK provides a default derivation rule (typically based on the local language’s type name); cross-language interop requires the same TypeId on every side, which users can pin via the SDK’s named attribute.
TypedSchemaValue
A typed value: a self-contained SchemaGraph paired with a value tree built against that schema.
UnionBranch
UnionSpec
An inferred-tag sum governed by the canonical portable pair-classification contract.
UnionValuePayload
UrlRestrictions
VariantCaseType
VariantValuePayload

Enums§

DiscriminatorRule
How the decoder identifies that a value belongs to a given union branch.
FromSchemaError
Errors produced by FromSchema::from_value.
HostManagedKind
A closed set of “host-managed” capability kinds.
HostManagedTraversalError
MergeError
Errors produced by merge_agent_graphs.
PathDirection
PathKind
ResultValuePayload
Result payload: exactly one of Ok / Err is set. Each inner option allows result<_, _> cases whose ok/err type is unit (no payload).
Role
Open registry of consumer-facing roles a type may carry. Unknown roles are preserved as Role::Other so the producer’s intent is not lost when a receiver does not understand the role.
SchemaFingerprintError
SchemaType
One schema type in the recursive in-memory representation.
SchemaValue
One node in the recursive in-memory schema-value tree.

Traits§

FromSchema
Decode a SchemaValue back into a Rust value.
IntoSchema
Convert a Rust type into a self-contained schema graph and a SchemaValue tree.
IntoTypedSchemaValue
Ergonomic value.into_typed_schema_value()? form of try_into_typed_schema_value, mirroring the legacy IntoValueAndType::into_value_and_type method shape.
QuantityUnit
Marker trait describing the unit constraints of a Quantity.

Functions§

find_host_managed_type
Finds the first host-managed capability type reachable from ty through graph. Only definitions reachable from ty are considered. Recursive references are followed once per active path, so recursive schemas terminate without suppressing occurrences reached through sibling paths.
find_host_managed_value
Finds the first host-managed capability in value, including nested occurrences in every structural container.
merge_agent_graphs
Merge the named definitions from any number of per-root SchemaGraphs into a single agent-level graph.
redacted_schema_value_debug
Wraps value for redacted Debug rendering. See RedactedSchemaValue.
resolve_stream_element_schema_v1
Resolves a stream element fingerprint against a pinned multi-root schema registry.
schema_fingerprint_v1
Computes the v1 stream element schema fingerprint.
try_into_schema_graph
Build a self-contained graph for T and run well-formedness validation on the result. Returns the first reported SchemaError if the graph is malformed.
try_into_typed_schema_value
Build a TypedSchemaValue — a self-contained SchemaGraph paired with the encoded SchemaValue tree — from a value whose type implements IntoSchema.

Type Aliases§

DecodeError
Backwards-compatible alias kept for codegen and consumers.

Derive Macros§

FromSchema
FromWire
Decodes canonical wire nodes directly into a concrete guest type.
IntoSchema
IntoWire
Converts a guest value directly to canonical wire nodes, including affine resource preflight. Does not construct or validate a schema model.
Schema
Derives IntoSchema, FromSchema, IntoWire, FromWire, and WireSchema. Requires the schema crate’s guest feature for the direct wire traits.
WireSchema
Appends a concrete type definition directly to the flat WIT schema arena.