Skip to main content

Module codegen

Module codegen 

Source
Expand description

Gleam type and JSON codec generation from project schemas. Gleam type + JSON codec generation from a workflow project’s JSON Schemas (aion codegen).

codegen_project reads a project’s workflow.toml and every schemas/*.json, and writes one deterministic Gleam module (src/<package>_io.gleam) containing a type plus an encoder/decoder pair per schema — the schema files stay the single source of truth, and the generated codecs cannot drift from them. CodegenMode::Check verifies the on-disk module instead of writing, for CI gates. The library never spawns processes; everything observable is in the returned CodegenReport 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.
CodecReport
The result of generating (or checking) a package’s codecs module.
CodegenReport
Result of a successful codegen run.
TestScaffoldReport
The result of generating (or checking) a workflow’s aion/testing skeleton.

Enums§

CodegenError
Errors produced while generating Gleam types and codecs from a workflow project’s JSON Schemas.
CodegenMode
What to do with the generated module.
Tier
Where an activity’s side-effecting body executes.

Functions§

build_input_skeleton
Builds a structurally-valid input skeleton from a workflow input_schema JSON-Schema document.
codegen_project
Generates Gleam types and JSON codecs for every schemas/*.json of the workflow project at root, writing or checking src/<package>_io.gleam per mode.
generate_activities
Generates (or, in CodegenMode::Check, verifies) the activity plumbing for the package at root from its declarations and schemas/*.json.
generate_codecs
Generates (or, in CodegenMode::Check, verifies) the package’s codecs module src/<package>_codecs.gleam from its schemas/*.json.
generate_test_scaffold
Generates (or, in CodegenMode::Check, verifies) 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.