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§

CodegenReport
Result of a successful codegen run.

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.

Functions§

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.