Skip to main content

Module codegen

Module codegen 

Source
Expand description

Gleam type and JSON codec generation from project schemas. Types-first codec generation (aion generate).

The authored source of truth is the project’s Gleam types module src/<package>_io.gleam (ADR-014, resolved types-first on 2026-07-02). boundary_types_from_interface maps the gleam export package-interface JSON — the CLI drives the toolchain; this library never spawns a process — into the boundary-type model, from which every artifact is generated: the codecs module (generate_codecs), the emitted schemas/*.json (emit_schemas), and the declaration-driven activity plumbing (generate_activities, generate_test_scaffold). CodegenMode::Check verifies the on-disk artifacts instead of writing, for CI drift gates. Everything observable is in the returned reports or CodegenError.

Structs§

ActivityArtifact
One generated file: its path and fully-rendered contents.
ActivityDeclaration
A validated activity declaration: the per-activity facts the generator needs.
ActivityReport
The result of generating (or checking) a package’s activity plumbing.
AwlWorkerScaffold
What to generate: one queue’s compiled contract, plus how the emitted crate reaches the document and the SDK.
BoundaryType
One public type of the authored types module, with everything the emitters need: its emitted schema path, its own definition, and the definitions of every sibling type it references transitively.
CodecReport
The result of generating (or checking) a package’s codecs module.
Connection
One connection the generated worker opens: the node it registers on and every action it serves there, in the document’s declaration order.
ConnectionPlan
The whole plan for one queue: its connections and the servable actions behind them.
ScaffoldedFile
One file of the scaffold: where it goes, what is in it, and who owns it.
SchemaEmitReport
The result of emitting (or checking) the schema artifacts.
ServableAction
One action the generated worker must serve: its name, its node pin, and the wire schemas the document declares for it.
TestScaffoldReport
The result of generating (or checking) a workflow’s aion/testing skeleton.
WorkerScaffold
A rendered scaffold: the connection plan it was derived from, and the files that realise it.

Enums§

AionDependency
Where the generated crate takes the aion SDK crates from.
AwlScaffoldError
Why a worker scaffold could not be generated.
CodegenError
Errors produced while generating codecs, schemas, and activity plumbing from a workflow project’s authored types module.
CodegenMode
What to do with generated output.
DocumentRoot
The directory the generated worker resolves the document’s schema("…") imports against.
FileOwnership
Who owns a generated file once it exists.
Tier
Where an activity’s side-effecting body executes.

Functions§

boundary_types_from_interface
Maps the gleam export package-interface JSON to the boundary-type model for the package’s types module src/<package_name>_io.gleam.
build_input_skeleton
Builds a structurally-valid input skeleton from a workflow input_schema JSON-Schema document.
emit_schemas
Emits (or, in CodegenMode::Check, verifies) schemas/<stem>.json for every boundary type.
emit_shell_manifest
Renders the strict shell-worker manifest and its operating instructions for one compiled queue contract.
generate_activities
Generates (or, in CodegenMode::Check, verifies) the activity plumbing for the package at root from its declarations and boundary types.
generate_codecs
Generates (or, in CodegenMode::Check, verifies) the package’s codecs module src/<package>_codecs.gleam from its boundary types.
generate_test_scaffold
Generates the aion/testing skeleton test/<entry_module>_scaffold_test.gleam for the workflow whose typed entry lives in src/<entry_module>.gleam.
parse_declarations
Parses and validates the canonical activity-manifest JSON.
scaffold_awl_worker
Renders the worker scaffold for one compiled queue contract.