oaspec/openapi/diagnostic_format

Human-readable rendering of diagnostic pointer strings. The machine layer — Diagnostic.pointer itself — is left untouched so future --format json output or any consumer that wants the raw JSON Pointer / dotted path can still read it verbatim. This module only owns the CLI presentation transform.

The function is deliberately spec-context free: it never looks a path up in a parsed spec. That is a larger follow-up; here the goal is simply to turn paths.~1pets.get.parameters.0 into GET /pets, parameter #0 so a reader does not need to know about JSON Pointer escape rules.

Values

pub fn pointer_to_human(pointer: String) -> String

Translate a diagnostic pointer into a human-readable location string.

Recognised shapes:

  • paths.<escaped>.<method>.parameters.<idx>[...]METHOD /path, parameter #idx[...]
  • paths.<escaped>.<method>.requestBody[...]METHOD /path, requestBody[...]
  • paths.<escaped>.<method>.responses.<status>[...]METHOD /path, response <status>[...]
  • paths.<escaped>.<method>[...]METHOD /path[...]
  • components.<kind>.<name>[...]<kind>.<name>[...]

Falls back to the escape-decoded pointer if no pattern matches, so callers always get something intelligible.

Search Document