GeezerVison is showing github.com — Fix ExecutableNormalizedField to respect GraphqlFieldVisibility by Samjin · Pull Request #4204 · graphql-java/graphql-java
Conversation
Samjin
commented
Jan 10, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Problem
ExecutableNormalizedField.forEachFieldDefinition() and getOneFieldDefinition() call type.getField(fieldName) directly, bypassing the schema's configured GraphqlFieldVisibility.
This is inconsistent with other parts of graphql-java (validation, execution) that respect field visibility, and causes issues when:
- A custom GraphqlFieldVisibility provides field definitions that differ from what's in the schema type (e.g., placeholder fields, virtual fields, or dynamically-computed fields)
- Application code accesses DataFetchingEnvironment.getSelectionSet().getFields() in a DataFetcher
- Normalization fails with "No field X found for type Y" because it bypasses the visibility
Reproduction
- Configure a custom
GraphqlFieldVisibility that provides virtual/placeholder fields
- Execute a query that includes a field only available through the visibility
- Access
DataFetchingEnvironment.getSelectionSet().getFields() in a DataFetcher
- Normalization fails because
ExecutableNormalizedField.forEachFieldDefinition() calls type.getField() directly
Solution
Change the field lookup to use the schema's field visibility:
// Before
type.getField(fieldName)
// After
schema.getCodeRegistry().getFieldVisibility().getFieldDefinition(type, fieldName)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Thanks for this
Hi bbakerman, can we please include this v26 beta? Let me know if you need a hand. Thanks
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.