oaspec/openapi/parser

Values

pub fn parse_error_to_string(
  error: diagnostic.Diagnostic,
) -> String

Convert a parse error to a human-readable string.

pub fn parse_file(
  path: String,
) -> Result(
  spec.OpenApiSpec(spec.Unresolved),
  diagnostic.Diagnostic,
)

Parse an OpenAPI spec from a file path. Supports both YAML (.yaml, .yml) and JSON (.json) files. After parsing, resolves relative-file $ref values in components.schemas by loading the referenced files from disk and merging their schemas. Nested or parameter/response external refs are left to downstream validation.

pub fn parse_schema_object(
  node: yay.Node,
  path: String,
  index: location_index.LocationIndex,
) -> Result(schema.SchemaObject, diagnostic.Diagnostic)

Parse a schema object.

pub fn parse_schema_ref(
  node: yay.Node,
  path: String,
  index: location_index.LocationIndex,
) -> Result(schema.SchemaRef, diagnostic.Diagnostic)

Parse a schema reference (either $ref or inline schema).

pub fn parse_string(
  content: String,
) -> Result(
  spec.OpenApiSpec(spec.Unresolved),
  diagnostic.Diagnostic,
)

Parse an OpenAPI spec from a YAML/JSON string.

Search Document