Skip to main content

Module encode

Module encode 

Source
Expand description

Type-directed argument encoding into the TRP TaggedArg wire form.

A resolve request carries an untyped TIR, so the resolver can’t recover the structure of an aggregate argument (record, list, tuple, map) on its own. The type lives in the .tii, so the SDK walks the resolved ParamType with the user value and emits the self-describing TaggedArg (single-key tagged, recursive — schema in core/trp/v1beta0/trp.json, prose in the SDK spec’s api-surface/args.md); the resolver then decodes it without a schema.

encode runs for every mapped arg as one recursive walk: a top-level scalar comes back bare (the resolver coerces it via the flat type), while aggregates and any nested leaf are tagged.

Enums§

EncodeError
An argument value whose shape does not match its declared ParamType, surfaced before the request is sent rather than as an opaque resolver error.

Functions§

encode
Marshals an argument value to its TRP wire form, directed by param.