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§
- Activity
Artifact - One generated file: its path and fully-rendered contents.
- Activity
Declaration - A validated activity declaration: the per-activity facts the generator needs.
- Activity
Report - The result of generating (or checking) a package’s activity plumbing.
- Codec
Report - The result of generating (or checking) a package’s codecs module.
- Codegen
Report - Result of a successful codegen run.
- Test
Scaffold Report - The result of generating (or checking) a workflow’s
aion/testingskeleton.
Enums§
- Codegen
Error - Errors produced while generating Gleam types and codecs from a workflow project’s JSON Schemas.
- Codegen
Mode - 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_schemaJSON-Schema document. - codegen_
project - Generates Gleam types and JSON codecs for every
schemas/*.jsonof the workflow project atroot, writing or checkingsrc/<package>_io.gleampermode. - generate_
activities - Generates (or, in
CodegenMode::Check, verifies) the activity plumbing for the package atrootfrom itsdeclarationsandschemas/*.json. - generate_
codecs - Generates (or, in
CodegenMode::Check, verifies) the package’s codecs modulesrc/<package>_codecs.gleamfrom itsschemas/*.json. - generate_
test_ scaffold - Generates (or, in
CodegenMode::Check, verifies) theaion/testingskeletontest/<entry_module>_scaffold_test.gleamfor the workflow whose typed entry lives insrc/<entry_module>.gleam. - parse_
declarations - Parses and validates the canonical activity-manifest JSON.