Skip to main content

codegen_project

Function codegen_project 

Source
pub fn codegen_project(
    root: &Path,
    mode: CodegenMode,
) -> Result<CodegenReport, CodegenError>
Expand description

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.

The project’s workflow.toml is validated first (including that every referenced schema exists, parses, and lives under schemas/), so codecs can never be generated from schemas the packaging boundary would reject.

§Errors

Returns a CodegenError naming the offending file — and, for schema constructs outside the supported subset, the JSON pointer — for: invalid or missing workflow.toml / gleam.toml, missing or unreadable schema files, invalid JSON, unsupported schema constructs, generated-name collisions, write failures, and --check drift.