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.
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.
SchemaEmitReport
The result of emitting (or checking) the schema artifacts.
TestScaffoldReport
The result of generating (or checking) a workflow’s aion/testing skeleton.

Enums§

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.
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.
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.