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(@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

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.

pub fn generate_all_files(
  ctx: @internal Context,
) -> List(@internal GeneratedFile)

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

pub fn generate_with_progress(
  spec: @internal OpenApiSpec(@internal Unresolved),
  cfg: config.Config,
  reporter: @internal Reporter,
) -> Result(GenerationSummary, GenerateError)

Same as generate, with a Reporter that receives one line per pipeline stage with elapsed time. Used by the CLI to surface progress for large specs (issue #352); library callers should prefer generate and pass progress.noop() if needed.

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(
  spec: @internal OpenApiSpec(@internal Unresolved),
  cfg: config.Config,
  reporter: @internal Reporter,
) -> Result(ValidationSummary, GenerateError)

Same as validate_only, with a Reporter that receives one line per pipeline stage with elapsed time. See generate_with_progress.

Search Document