fix fragment definition directive variable handling#426
Merged
StevenACoffman merged 1 commit intovektah:masterfrom Apr 30, 2026
Merged
Conversation
Collaborator
|
@jbellenger thanks for this! Tha validation rules in gqlparser are imported directly from the reference implementation test suite using this process: https://github.com/vektah/gqlparser/tree/master/validator/imported I'm wondering if there's a similar way to collect and export from your repository. |
Contributor
Author
|
Hi @StevenACoffman ! This is an interesting idea. The test corpus and the system that manages it is currently in flux and I don't think it's stable enough to build on (yet). But this use-case has been in the back of my mind for a little while -- let me think about it for a bit and then follow-up with you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hi there! I'm the maintainer of graphql-conformance, which verifies spec conformance across the graphql ecosystem.
I noticed that gqlgen had some test failures that appear to originate in gqlparser.
The issue is that gqlparser does not walk directives on fragment definitions. When those directives are the only use of a variable, then those variables will be marked as unused and will incorrectly produce a validation error.
For example, in this configuration:
gqlparser produces this error:
This PR fixes this by walking directives of fragment definitions.
Thank you for considering this PR! I'm not familiar with this code-base or its conventions, so please feel free to point out any issue no matter how small.