Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@benjie @leebyron This PR implements the changes on top of the existing
schema-coordinates
branch as discussed in July's WG meeting:https://github.com/graphql/graphql-wg/blob/main/notes/2025/2025-07.md#schema-coordinates
Specifically:
SchemaCoordinateLexer
class insidesrc/language/schemaCoordinateLexer
{createToken, printCodePointAt, readName}
helpersLexerInterface
interface to allow the helpers to accept either instance of a Lexer without copy/pasting.What I dislike about this PR:
LexerInterface
)What I like about this PR:
tl;dr if we tried to completely devolve
Parser
of responsibility of schema coordinates, and started on a minimal implementation ofparseSchemaCoordinate()
that advances a lexer instance token by token, we'd end up at something very similar to Parser.... I did try a few versions of this and copy and pasting things but this ended up being neater overall.FWIW I did start to a attempt a minimal
parseSchemaCoordinate()
function here: https://github.com/magicmark/graphql-js/blob/586b7174dc730fef47368ce4fbc385fb1f733360/src/language/schemaCoordinate.ts#L44but it turns out that doing it imperatively and correctly without a nice lexer/parser is kinda hard! the more logic I add to this, the closer I get to essentially recreating a lexer/parser... which we already have :)
wdyt? should we keep trying for more of a middle ground here?