Skip to main content

CodegenError

Enum CodegenError 

Source
pub enum CodegenError {
Show 23 variants Config(PackagingError), ProjectName { name: String, reason: String, }, SchemaOutsideSchemasDir { field: String, path: PathBuf, }, SchemasDirMissing { path: PathBuf, }, SchemasDirEmpty { path: PathBuf, }, SchemasDirRead { path: PathBuf, source: Error, }, SchemaRead { path: PathBuf, source: Error, }, SchemaParse { path: PathBuf, source: Error, }, SchemaFileName { path: PathBuf, reason: String, }, UnsupportedConstruct { file: PathBuf, pointer: String, construct: String, }, NameCollision { name: String, first_file: PathBuf, first_pointer: String, second_file: PathBuf, second_pointer: String, }, Write { path: PathBuf, source: Error, }, CheckMissing { path: PathBuf, }, CheckDrift { path: PathBuf, }, CheckRead { path: PathBuf, source: Error, }, ManifestParse { source: Error, }, InvalidActivityName { name: String, reason: String, }, DuplicateActivity { name: String, }, UnknownTier { value: String, }, ActivitySchemaMissing { activity: String, role: &'static str, type_name: String, path: PathBuf, }, GoldenTypeUnresolved { root_type: String, missing: String, file: PathBuf, }, EntrySourceRead { path: PathBuf, source: Error, }, ScaffoldFacts { path: PathBuf, reason: String, },
}
Expand description

Errors produced while generating Gleam types and codecs from a workflow project’s JSON Schemas.

Every variant carries the offending file, JSON pointer, or path as structured data so callers can render actionable guidance. Schema-shape failures always name the schema file and the JSON pointer of the offending construct.

Variants§

§

Config(PackagingError)

The project descriptor (workflow.toml) or a schema it references failed to load: missing descriptor, invalid TOML, a referenced schema file that does not exist, or invalid JSON in a referenced schema.

§

ProjectName

The project’s gleam.toml declares a package name that cannot prefix a generated Gleam module.

Fields

§name: String

The declared package name.

§reason: String

Why the name cannot be used.

§

SchemaOutsideSchemasDir

A workflow.toml entry references a schema outside the project’s schemas/ directory, where codegen would never see it; schema/codec drift protection requires every referenced schema to live there.

Fields

§field: String

Descriptor field that declared the path, e.g. workflow[0].input_schema.

§path: PathBuf

The resolved schema path.

§

SchemasDirMissing

The project has no schemas/ directory to generate from.

Fields

§path: PathBuf

The expected schemas/ directory.

§

SchemasDirEmpty

The schemas/ directory exists but contains no *.json files.

Fields

§path: PathBuf

The searched schemas/ directory.

§

SchemasDirRead

The schemas/ directory could not be listed.

Fields

§path: PathBuf

The schemas/ directory that could not be listed.

§source: Error

I/O failure reported while listing the directory.

§

SchemaRead

A schema file could not be read.

Fields

§path: PathBuf

The schema file that could not be read.

§source: Error

I/O failure reported while reading the file.

§

SchemaParse

A schema file is not valid JSON (including duplicate object keys, which would make property order ambiguous).

Fields

§path: PathBuf

The schema file that failed to parse.

§source: Error

JSON parsing failure reported by serde_json.

§

SchemaFileName

A schema file name cannot derive a Gleam type name.

Fields

§path: PathBuf

The offending schema file.

§reason: String

Why the file name cannot derive a type name.

§

UnsupportedConstruct

A schema uses a construct outside the supported v1 subset.

Fields

§file: PathBuf

The schema file containing the construct.

§pointer: String

JSON pointer to the offending construct ( is the document root).

§construct: String

What the construct was and, where helpful, what is supported.

§

NameCollision

Two schema locations derive the same generated Gleam name.

Fields

§name: String

The colliding generated type or constructor name.

§first_file: PathBuf

Schema file of the first derivation.

§first_pointer: String

JSON pointer of the first derivation.

§second_file: PathBuf

Schema file of the second derivation.

§second_pointer: String

JSON pointer of the second derivation.

§

Write

The generated module could not be written.

Fields

§path: PathBuf

The module path that could not be written.

§source: Error

I/O failure reported while writing.

§

CheckMissing

--check failed: the generated module does not exist on disk.

Fields

§path: PathBuf

The expected generated module path.

§

CheckDrift

--check failed: the on-disk module differs from the generated output.

Fields

§path: PathBuf

The drifted generated module path.

§

CheckRead

The on-disk module could not be read for --check comparison.

Fields

§path: PathBuf

The module path that could not be read.

§source: Error

I/O failure reported while reading.

§

ManifestParse

The activity manifest JSON emitted by the package’s manifest() export is not a valid declaration array.

Fields

§source: Error

JSON parsing failure reported by serde_json.

§

InvalidActivityName

A declared activity name cannot name an engine activity or a generated artifact (empty, or carrying a path separator, backslash, or the deployed-name separator).

Fields

§name: String

The offending activity name.

§reason: String

Why the name cannot be used.

§

DuplicateActivity

Two declarations share an activity name; names must be unique within a package so the generated wrappers, registration entries, and workflow.toml list are unambiguous.

Fields

§name: String

The duplicated activity name.

§

UnknownTier

A declaration carries a tier outside the supported set.

Fields

§value: String

The unrecognised tier string.

§

ActivitySchemaMissing

A declared activity references a value type with no schemas/<type>.json document, so its codec cannot be generated.

Fields

§activity: String

The activity whose type is unresolved.

§role: &'static str

Which side of the activity the type is on (input or output).

§type_name: String

The unresolved value type name.

§path: PathBuf

The schema path that was expected to exist.

§

GoldenTypeUnresolved

While deriving a wire-compat golden, a value type referenced a named Gleam type absent from its schema artifact’s definitions. The schema walker emits every nested record and enum into the artifact, so this signals a generator invariant violation rather than bad author input.

Fields

§root_type: String

The value type whose golden was being derived.

§missing: String

The named type that could not be found in the artifact definitions.

§file: PathBuf

The schema artifact whose definitions were searched.

§

EntrySourceRead

The test-scaffold generator could not read the workflow’s entry-module source, which it needs to derive the typed entry function and timer count.

Fields

§path: PathBuf

The entry-module source path that could not be read.

§source: Error

The underlying I/O error.

§

ScaffoldFacts

The workflow’s entry-module source does not yield the facts the test scaffold needs (no aion/workflow import, no define call, or an unidentifiable typed entry function).

Fields

§path: PathBuf

The entry-module source path the facts were read from.

§reason: String

Why the facts could not be derived.

Trait Implementations§

Source§

impl Debug for CodegenError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for CodegenError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for CodegenError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<PackagingError> for CodegenError

Source§

fn from(source: PackagingError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.