oaspec/codegen/context

Types

Context for code generation, carrying all needed state. Accepts a spec at any stage so the pipeline can create context before full resolution (hoist/dedup operate on Unresolved).

pub type Context {
  Context(
    spec: spec.OpenApiSpec(spec.SpecStage),
    config: config.Config,
  )
}

Constructors

Target for a generated file, indicating where it should be written.

pub type FileTarget {
  SharedTarget
  ServerTarget
  ClientTarget
}

Constructors

  • SharedTarget
  • ServerTarget
  • ClientTarget

A generated file with its path, content, and output target.

pub type GeneratedFile {
  GeneratedFile(
    path: String,
    content: String,
    target: FileTarget,
  )
}

Constructors

  • GeneratedFile(path: String, content: String, target: FileTarget)

Values

pub fn new(
  spec: spec.OpenApiSpec(spec.SpecStage),
  config: config.Config,
) -> Context

Create a new generation context.

pub const version: String

The version of oaspec used for generated code headers.

Search Document