RFC: libgraphql-parser with error recovery and diagnostics
โ Rust ๐ 2026-04-08 ๐ค surdeus ๐๏ธ 6Hey all,
So I recently built and published libgraphql-parser which is a GraphQL parser that aims for 2025 GraphQL spec conformance and supports error recovery, Rust-style error messages/diagnostics, and an optionally-lossless AST (comments, whitespace, and commas can optionally be preserved) intended to support a few GraphQL tools I work on.
As a fun side effect of spending a lot of time optimizing and generating tests, it also ended up beating the parsing performance of both graphql-parser and apollo-parser in the benchmarks I ran.
I built it to support some GraphQL tools and libs where I wanted to raise the bar on parser errors and diagnostics (e.g. libgraphql::macros::graphql_schema!(): Write GraphQL schemas directly in Rust --> get compile-time GraphQL validation errors).
Anyway Im pretty happy with where itโs gotten so far and I plan to move more of my GraphQL tooling over to use it, but before I go too much further Iโd love feedback from people who have:
- been through the trenches building error-tolerant and/or perf-sensitive parsers
- opinions on parsing APIs and error-recovery strategies
- worked on GraphQL tooling before
Code: libgraphql/crates/libgraphql-parser at main ยท jeffmo/libgraphql ยท GitHub
Thanks in advance!
-Jeff
1 post - 1 participant
๐ท๏ธ Rust_feed