Skip to main content

Module schema

Module schema 

Source
Expand description

TypeScript schema generation for runtime service descriptors.

Generates the ServiceDescriptor constant used by the runtime to perform schema-driven decode/encode for all methods. The generated code has zero serialization logic — everything is driven by the descriptor at runtime.

Each method descriptor has:

  • args: a tuple schema covering all arguments (decoded once before dispatch)
  • result: the full Result<T, RoamError<E>> enum schema for encoding responses

The RoamError<E> schema always has four variants at fixed indices:

  • 0: User(E) — user-defined error (null fields for infallible methods)
  • 1: UnknownMethod — unit
  • 2: InvalidPayload — unit
  • 3: Cancelled — unit

Functions§

generate_descriptor
Generate the service descriptor constant.
generate_schema
Generate a TypeScript Schema object literal for a type.