Skip to content

Add the maxTokens parser option - #1990

Open
Amoifr wants to merge 1 commit into
webonyx:masterfrom
Amoifr:feat-1905-parser-max-tokens
Open

Amoifr wants to merge 1 commit into
webonyx:masterfrom
Amoifr:feat-1905-parser-max-tokens

Conversation

@Amoifr

@Amoifr Amoifr commented Oct 4, 2026

Copy link
Copy Markdown

Resolves #1905.

Adds the maxTokens parser option from graphql-js (graphql/graphql-js#3684): the parser counts the tokens it consumes and throws a SyntaxError once the document exceeds the limit. There is no limit by default.

All the Lexer::advance() calls of the parser now go through a single advanceLexer() method that does the counting, as in the reference implementation. The error message follows the current graphql-js wording ("more than", the original "more that" typo was fixed there), and the graphql-js test is ported with its @see it(...) annotation.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add maxTokens option to Parser

1 participant