oaspec/generate

Types

Errors from the pure generation pipeline.

pub type GenerateError {
  ValidationErrors(errors: List(diagnostic.Diagnostic))
}

Constructors

Result of a successful code generation run.

pub type GenerationSummary {
  GenerationSummary(
    files: List(context.GeneratedFile),
    spec_title: String,
    warnings: List(diagnostic.Diagnostic),
  )
}

Constructors

Result of a successful validation-only run.

pub type ValidationSummary {
  ValidationSummary(
    spec_title: String,
    warnings: List(diagnostic.Diagnostic),
  )
}

Constructors

Values

pub fn generate(
  spec: spec.OpenApiSpec(spec.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.

pub fn generate_all_files(
  ctx: context.Context,
) -> List(context.GeneratedFile)

Pure file generation: produce all GeneratedFile values without any IO.

pub fn validate_only(
  spec: spec.OpenApiSpec(spec.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.

Search Document