Skip to content

No {Ignored} tokens when parsing schema coordinates #4450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 6, 2025

Conversation

magicmark
Copy link

@magicmark magicmark commented Jul 4, 2025

I took a stab at @benjie's suggestion (which I 100% agree with) to disallow ignored tokens in schema coordinates.

(This caught an instance of whitespace in on of our tests!)

cc @yaacovCR @martinbonnin

benjie

This comment was marked as outdated.

@benjie
Copy link
Member

benjie commented Jul 4, 2025

@magicmark I was starting to write an alternative here, but decided to just implement it, so check out #4451 - it adds a single commit on top of this PR that refactors to using an alternative lexer for schema coordinates. (If you like it just cherry-pick that commit into this PR and we can close the other one.)

@magicmark
Copy link
Author

magicmark commented Jul 4, 2025

@benjie done! cherry picked.

I also added a test for SchemaCoordinateLexer (was getting a coverage report issue on get [Symbol.toStringTag]())

@magicmark magicmark requested a review from benjie July 4, 2025 23:36
Copy link
Member

@benjie benjie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but @JoviDeCroock / @yaacovCR should sign off in the changes to the public API

describe('SchemaCoordinateLexer', () => {
it('can be stringified', () => {
const lexer = new SchemaCoordinateLexer(new Source('Name.field'));
expect(Object.prototype.toString.call(lexer)).to.equal(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be roughly equivalent?

Suggested change
expect(Object.prototype.toString.call(lexer)).to.equal(
expect(String(lexer)).to.equal(

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deferring to prior art / established convention https://github.com/search?q=repo%3Agraphql%2Fgraphql-js%20Object.prototype.toString.call&type=code

(but I agree with you)

@JoviDeCroock JoviDeCroock merged commit 04dd13e into graphql:schema-coordinates Jul 6, 2025
16 checks passed
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.

3 participants