oaspec/openapi/diagnostic

Types

Unified diagnostic type for all pipeline phases.

pub type Diagnostic {
  Diagnostic(
    code: String,
    phase: Phase,
    severity: Severity,
    target: Target,
    pointer: String,
    source_loc: SourceLoc,
    message: String,
    hint: option.Option(String),
  )
}

Constructors

Pipeline phase that produced the diagnostic.

pub type Phase {
  PhaseParse
  PhaseNormalize
  PhaseResolve
  PhaseCapabilityCheck
  PhaseValidate
  PhaseCodegen
}

Constructors

  • PhaseParse
  • PhaseNormalize
  • PhaseResolve
  • PhaseCapabilityCheck
  • PhaseValidate
  • PhaseCodegen

Severity level for diagnostics.

pub type Severity {
  SeverityError
  SeverityWarning
}

Constructors

  • SeverityError
  • SeverityWarning

Source location from YAML/JSON parsing.

pub type SourceLoc {
  SourceLoc(line: Int, column: Int)
  NoSourceLoc
}

Constructors

  • SourceLoc(line: Int, column: Int)
  • NoSourceLoc

Target indicating which generation mode the issue applies to.

pub type Target {
  TargetBoth
  TargetClient
  TargetServer
}

Constructors

  • TargetBoth
  • TargetClient
  • TargetServer

Values

pub fn capability(
  path path: String,
  detail detail: String,
  severity severity: Severity,
  target target: Target,
  hint hint: option.Option(String),
) -> Diagnostic
pub fn errors_only(issues: List(Diagnostic)) -> List(Diagnostic)

Filter to only errors (not warnings).

pub fn file_error(detail detail: String) -> Diagnostic
pub fn filter_by_mode(
  issues: List(Diagnostic),
  mode: config.GenerateMode,
) -> List(Diagnostic)

Filter diagnostics to those relevant for the selected generation mode.

pub fn invalid_value(
  path path: String,
  detail detail: String,
  loc loc: SourceLoc,
) -> Diagnostic
pub fn missing_field(
  path path: String,
  field field: String,
  loc loc: SourceLoc,
) -> Diagnostic
pub fn resolve_error(
  path path: String,
  detail detail: String,
  hint hint: option.Option(String),
  loc loc: SourceLoc,
) -> Diagnostic
pub fn to_short_string(d: Diagnostic) -> String

Convert a diagnostic to a short string (for backward-compatible display).

pub fn to_string(d: Diagnostic) -> String

Convert a diagnostic to a human-readable string.

pub fn validation(
  path path: String,
  detail detail: String,
  severity severity: Severity,
  target target: Target,
  hint hint: option.Option(String),
) -> Diagnostic
pub fn warnings_only(
  issues: List(Diagnostic),
) -> List(Diagnostic)

Filter to only warnings (not errors).

pub fn yaml_error(
  detail detail: String,
  loc loc: SourceLoc,
) -> Diagnostic
Search Document