oaspec/codegen/writer
Types
Errors that can occur during file writing.
pub type WriteError {
DirectoryCreateError(path: String, detail: String)
FileWriteError(path: String, detail: String)
}
Constructors
-
DirectoryCreateError(path: String, detail: String) -
FileWriteError(path: String, detail: String)
Values
pub fn error_to_string(error: WriteError) -> String
Convert a write error to a human-readable string.
pub fn expected_paths(
files: List(context.GeneratedFile),
cfg: config.Config,
) -> List(String)
Every file path the generator would write for the given config — including
SkipIfExists files. Used by --check to keep user-owned handlers.gleam
off the orphan list while still excluding it from byte-comparison drift
reports (resolve_paths drops SkipIfExists entries).
pub fn output_dirs(cfg: config.Config) -> List(String)
Return the output directories that would be written to for the given config.
pub fn resolve_paths(
files: List(context.GeneratedFile),
cfg: config.Config,
) -> List(#(String, String))
Resolve generated files to their full output paths and content. Used by –check to compare against existing files without writing.
Issue #247: SkipIfExists files (e.g. user-owned handlers.gleam)
are dropped from the result. --check is meant to flag drift in
generator-owned files; user-edited files are expected to differ
from the bootstrap stub and should not be reported as out-of-date.
pub fn write_all(
files: List(context.GeneratedFile),
cfg: config.Config,
on_write: fn(String) -> Nil,
) -> Result(List(String), WriteError)
Write pre-generated files to disk based on configuration.