nori_asyncapi/yaml

YAML / JSON loading for AsyncAPI specs.

Same bridge nori uses: taffy parses YAML to a YamlValue, round-trips it to JSON, then the AsyncAPI decoder runs over the Dynamic.

Types

pub type LoadError {
  SyntaxError(message: String)
  DecodeErrors(errors: List(decode.DecodeError))
  FileError(path: String, message: String)
}

Constructors

  • SyntaxError(message: String)
  • DecodeErrors(errors: List(decode.DecodeError))
  • FileError(path: String, message: String)

Values

pub fn parse_file(
  path: String,
) -> Result(document.Document, LoadError)

Load and parse a spec file (.yaml/.yml → YAML, .json → JSON, else YAML first since it is a JSON superset).

pub fn parse_json(
  input: String,
) -> Result(document.Document, LoadError)

Parse an AsyncAPI document from a JSON string.

pub fn parse_yaml(
  input: String,
) -> Result(document.Document, LoadError)

Parse an AsyncAPI document from a YAML string.

Search Document