oaspec/openapi/parser

Types

Errors that can occur during OpenAPI spec parsing.

pub type ParseError {
  FileError(detail: String)
  YamlError(detail: String)
  MissingField(path: String, field: String)
  InvalidValue(path: String, detail: String)
}

Constructors

  • FileError(detail: String)
  • YamlError(detail: String)
  • MissingField(path: String, field: String)
  • InvalidValue(path: String, detail: String)

Values

pub fn parse_error_to_string(error: ParseError) -> String

Convert a parse error to a human-readable string.

pub fn parse_file(
  path: String,
) -> Result(spec.OpenApiSpec, ParseError)

Parse an OpenAPI spec from a file path. Supports both YAML (.yaml, .yml) and JSON (.json) files.

pub fn parse_schema_object(
  node: yay.Node,
) -> Result(schema.SchemaObject, ParseError)

Parse a schema object.

pub fn parse_schema_ref(
  node: yay.Node,
) -> Result(schema.SchemaRef, ParseError)

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

pub fn parse_string(
  content: String,
) -> Result(spec.OpenApiSpec, ParseError)

Parse an OpenAPI spec from a YAML/JSON string.

Search Document