oaspec/openapi/location_index
Types
An index mapping dotted JSON-pointer paths to source locations. Built by parsing YAML with yamerl (which preserves line/column), then looked up when emitting diagnostics.
pub opaque type LocationIndex
Values
pub fn build(content: String) -> LocationIndex
Build a location index from raw YAML/JSON content. On failure (e.g. invalid YAML), returns an empty index.
pub fn lookup(
index: LocationIndex,
path: String,
) -> diagnostic.SourceLoc
Look up the source location for a given path.
Returns NoSourceLoc if the path is not in the index.
pub fn lookup_field(
index: LocationIndex,
parent: String,
field: String,
) -> diagnostic.SourceLoc
Look up the source location for a field within a parent path.
Tries parent.field first, then falls back to parent, then NoSourceLoc.