oaspec/generate
Types
Errors from the pure generation pipeline.
pub type GenerateError {
ValidationErrors(errors: List(diagnostic.Diagnostic))
}
Constructors
-
ValidationErrors(errors: List(diagnostic.Diagnostic))
Result of a successful code generation run.
pub type GenerationSummary {
GenerationSummary(
files: List(@internal GeneratedFile),
spec_title: String,
warnings: List(diagnostic.Diagnostic),
)
}
Constructors
-
GenerationSummary( files: List(@internal GeneratedFile), spec_title: String, warnings: List(diagnostic.Diagnostic), )
Result of a successful validation-only run.
pub type ValidationSummary {
ValidationSummary(
spec_title: String,
warnings: List(diagnostic.Diagnostic),
)
}
Constructors
-
ValidationSummary( spec_title: String, warnings: List(diagnostic.Diagnostic), )
Values
pub fn generate(
spec: @internal OpenApiSpec(@internal Unresolved),
cfg: config.Config,
) -> Result(GenerationSummary, GenerateError)
Pure generation pipeline: parse → normalize → resolve → capability_check → hoist → dedup → validate → codegen. Takes an already-parsed spec and config; returns generated files or errors. Does not perform IO — callers handle writing files and printing output.
Capability-check diagnostics from this entry point carry no source
location information. Callers that already have a YAML
LocationIndex (e.g. via parser.parse_file_with_locations)
should prefer generate_with_locations so capability-check errors
surface line/column for the offending spec node (Issue #411).
pub fn generate_all_files(
ctx: @internal Context,
) -> List(@internal GeneratedFile)
Pure file generation: produce all GeneratedFile values without any IO.
The Reporter plumbing lives in generate_all_files_with_progress;
callers that want progress events (the CLI) go through the
progress-aware wrapper. Library callers that need the values
without progress noise pay nothing — progress.noop() is cheap.
pub fn generate_with_progress_and_locations(
spec: @internal OpenApiSpec(@internal Unresolved),
index: @internal LocationIndex,
cfg: config.Config,
reporter: @internal Reporter,
) -> Result(GenerationSummary, GenerateError)
Combined entry point that accepts both a LocationIndex and a
Reporter. Issue #411 + #352. The CLI uses this so it can show
per-stage progress AND surface path:line:column: in capability
errors at the same time. Library callers that need only one of the
two can pass location_index.empty() or progress.noop().
pub fn validate_only(
spec: @internal OpenApiSpec(@internal Unresolved),
cfg: config.Config,
) -> Result(ValidationSummary, GenerateError)
Validation-only pipeline: parse → normalize → resolve → capability_check → hoist → dedup → validate. Runs the same checks as generate() but skips code generation and file writing.
pub fn validate_only_with_progress_and_locations(
spec: @internal OpenApiSpec(@internal Unresolved),
index: @internal LocationIndex,
cfg: config.Config,
reporter: @internal Reporter,
) -> Result(ValidationSummary, GenerateError)
Combined validate_only entry point that accepts both a
LocationIndex and a Reporter. Issue #411 + #352.