Expand description
Runtime trait surface for converting Rust values to and from the recursive schema model.
The two core traits are:
IntoSchema— emits a self-containedSchemaGraphfor a type and converts a Rust value of that type into a matchingSchemaValue.FromSchema— decodes aSchemaValueback into a Rust value.
Hand-written impls for the standard primitive set live below. Derived
impls are generated by the golem-schema-derive crate, but the traits
themselves can be implemented by hand for any type that needs a custom
mapping.
Structs§
- Quantity
- A fixed-point decimal value with a unit, constrained by the
QuantityUnitmarkerU. Encodes to the richSchemaValue::Quantity. - Schema
Builder - Mutable working set used while a graph is being built up.
Enums§
- From
Schema Error - Errors produced by
FromSchema::from_value. - Merge
Error - Errors produced by
merge_agent_graphs.
Traits§
- From
Schema - Decode a
SchemaValueback into a Rust value. - Into
Schema - Convert a Rust type into a self-contained schema graph and a
SchemaValuetree. - Into
Typed Schema Value - Ergonomic
value.into_typed_schema_value()?form oftry_into_typed_schema_value, mirroring the legacyIntoValueAndType::into_value_and_typemethod shape. - Quantity
Unit - Marker trait describing the unit constraints of a
Quantity.
Functions§
- binary_
from_ value - binary_
to_ value - default_
type_ id_ from - Default
TypeIdderivation from acore::any::type_name::<Self>()output. Equivalent tonormalize_type_pathbut exposed under a generated-code-friendly name. - merge_
agent_ graphs - Merge the named definitions from any number of per-root
SchemaGraphs into a single agent-level graph. - normalize_
type_ path - Normalize a Rust path-form name into the dotted FQN used by
TypeId. - path_
from_ value - path_
to_ value - text_
from_ value - text_
to_ value - try_
into_ schema_ graph - Build a self-contained graph for
Tand run well-formedness validation on the result. Returns the first reportedSchemaErrorif the graph is malformed. - try_
into_ typed_ schema_ value - Build a
TypedSchemaValue— a self-containedSchemaGraphpaired with the encodedSchemaValuetree — from a value whose type implementsIntoSchema. - type_
id_ with_ args - Build a
TypeIdfor a generic instantiation.baseis the already-normalized base name (e.g.,"my_crate.Container") andargsare the resolved argumentTypeIds in declaration order. - url_
from_ value - url_
to_ value - value_
kind - Stringify the kind of a
SchemaValuefor error messages.
Type Aliases§
- Decode
Error - Backwards-compatible alias kept for codegen and consumers.