gitwtfhub

wtf is oxc-yaml-parser?

oxc-project/oxc-yaml-parser — explained in plain English

Analysis updated 2026-05-18

14RustAudience · developerComplexity · 3/5LicenseSetup · easy

TL;DR

A Rust library that parses YAML files into a structured form while preserving comments and exact formatting, built for making formatters.

Mindmap

mindmap
  root((repo))
    What it does
      Parses YAML into an AST
      Preserves comments and spans
    Tech stack
      Rust
    Use cases
      Build YAML formatters
      Programmatic YAML parsing
      Detect syntax errors
    Audience
      Developers
      Tooling authors
    Setup
      Add as Rust dependency
      Run conformance tests

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Build a YAML code formatter that needs to preserve comments and original formatting.

REASON 2

Parse YAML files into a structured tree for further programmatic processing.

REASON 3

Detect YAML syntax errors with exact source locations.

What's in the stack?

Rust

How it stacks up

oxc-project/oxc-yaml-parseraloxaf/leetcode_preludebadbread/crumbvms
Stars141414
LanguageRustRustRust
Last pushed2023-11-11
MaintenanceDormant
Setup difficultyeasyeasyhard
Complexity3/52/54/5
Audiencedeveloperdeveloperops devops

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 30min

Wtf does this do

oxc-yaml-parser is a small building block library, written in Rust, that reads YAML files, a common configuration file format, and turns them into a structured representation a computer program can work with. It is meant specifically for developers building tools that need to rewrite or reformat YAML files while keeping the original formatting details intact. Most parsers that read YAML throw away small details like comments and exact spacing once they understand the meaning of the file. This one is built differently: it keeps comments attached to the structure with their exact position in the original text, and it does not convert values like numbers or dates into their final form, instead pointing back to the exact original text for each value. This matters for a tool like a code formatter, which needs to reproduce the file's original content faithfully rather than just its meaning. The project deliberately does not try to resolve more advanced YAML features like schemas, tags, or reference shortcuts within a file, focusing only on reading the raw structure correctly. If the input YAML has a syntax error, the parser stops immediately and reports exactly where the problem is, rather than returning a partial or guessed result. To check that it works correctly, the project runs its parser against three separate sets of test YAML files, including an official YAML test suite and fixtures used by the popular Prettier code formatter, and stores the results so any changes in behavior can be reviewed. The README states that all valid YAML in these test sets currently parses successfully. The project is part of the oxc family of Rust based JavaScript and web tooling projects, and it is licensed under the MIT license, with some of its internal scanning logic derived from an existing open source YAML scanning library.

Yoink these prompts

Prompt 1
Show me how to use oxc-yaml-parser to parse a YAML string and print its resulting structure in Rust.
Prompt 2
Explain why this parser keeps comments and original spacing instead of just extracting values.
Prompt 3
Help me understand the difference between this parser and a typical YAML library that resolves schemas and tags.
Prompt 4
Walk me through running the project's conformance tests against the official YAML test suite.

Frequently asked questions

wtf is oxc-yaml-parser?

A Rust library that parses YAML files into a structured form while preserving comments and exact formatting, built for making formatters.

What language is oxc-yaml-parser written in?

Mainly Rust. The stack also includes Rust.

How hard is oxc-yaml-parser to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is oxc-yaml-parser for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.