RFC: libgraphql-parser with error recovery and diagnostics

โš“ Rust    ๐Ÿ“… 2026-04-08    ๐Ÿ‘ค surdeus    ๐Ÿ‘๏ธ 6      

surdeus

Hey 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

Read full topic

๐Ÿท๏ธ Rust_feed