Skip to content

Conversation

@Ko-Lin
Copy link
Contributor

@Ko-Lin Ko-Lin commented Aug 12, 2025

Summary

According to the GraphQL spec, enums are valid input types and must not be skipped when constructing input fields. This change ensures enum-typed fields are included during schema introspection.

Motivation and Context

Previously, enum-typed fields were excluded from input values during introspection. This led to a schema that diverged from the GraphQL spec and could break clients relying on enum inputs. This PR removes that exclusion so enums appear correctly in introspection and can be used as intended.

Changes

  • Remove exclusion of enum-typed fields in SchemaIntrospection when building input values.
  • Add unit test verifying enum-typed input fields are exposed via introspection:
    • tests/EntityGraphQL.Tests/IntrospectionTests/IntrospectionTests.csIncludeEnumInputField_Introspection

Key edit:

- // Skipping ENUM type
- if (field.ReturnType.TypeDotnet.IsEnum)
-     continue;

File touched:

  • src/EntityGraphQL/Schema/SchemaIntrospection.cs

Backwards Compatibility

  • No breaking changes. This is a standards-compliance fix that exposes previously hidden enum input fields via introspection.

Performance Considerations

  • Negligible impact. Only affects introspection-time field collection.

Tests

  • Added IncludeEnumInputField_Introspection which:
    • Builds an input type containing enum fields
    • Queries __type(name: "EnumInputArgs").inputFields and asserts the HeightUnit field is reported as ENUM (wrapped in NON_NULL)
  • Existing tests continue to pass.

Documentation

  • Not required; behavior now matches spec. If desired, add a short note in docs/ indicating enum input types are supported and appear in introspection.

Related Issues/PRs

  • N/A (link if applicable)

Checklist

  • Builds locally
  • Tests pass locally
  • Public API unchanged; behavior aligns with GraphQL spec
  • No changes to generated Antlr artifacts

@lukemurray lukemurray merged commit 7f95693 into EntityGraphQL:master Aug 12, 2025
1 check 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.

2 participants