FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix ExecutableNormalizedField to respect GraphqlFieldVisibility by Samjin · Pull Request #4204 · graphql-java/graphql-java · GitHub

Fix ExecutableNormalizedField to respect GraphqlFieldVisibility - #4204

Merged
bbakerman merged 1 commit into
graphql-java:masterfrom
Samjin:enf-respect-field-visibility
Jan 27, 2026
Merged

Fix ExecutableNormalizedField to respect GraphqlFieldVisibility#4204
bbakerman merged 1 commit into
graphql-java:masterfrom
Samjin:enf-respect-field-visibility

Conversation

Samjin commented Jan 10, 2026
edited
Loading

Copy link
Copy Markdown

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

  1. Configure a custom GraphqlFieldVisibility that provides virtual/placeholder fields
  2. Execute a query that includes a field only available through the visibility
  3. Access DataFetchingEnvironment.getSelectionSet().getFields() in a DataFetcher
  4. 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)

bbakerman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for this

bbakerman added this to the 26.x breaking changes milestone Jan 27, 2026

bbakerman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks

bbakerman merged commit 9f18071 into graphql-java:master Jan 27, 2026
4 checks passed

Samjin commented Feb 10, 2026

Copy link
Copy Markdown
Author

Thanks for this

Hi bbakerman, can we please include this v26 beta? Let me know if you need a hand. Thanks

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL