Skip to content

Add custom directive introspection and repeatable directive validation#471

Merged
hlship merged 4 commits intowalmartlabs:masterfrom
1e16miin:feat/custom-directives-introspection-with-repeatable
Oct 17, 2025
Merged

Add custom directive introspection and repeatable directive validation#471
hlship merged 4 commits intowalmartlabs:masterfrom
1e16miin:feat/custom-directives-introspection-with-repeatable

Conversation

@1e16miin
Copy link
Contributor

Summary

  • Fixes custom directives not appearing in GraphQL introspection queries
  • Adds missing TypeSystemDirectiveLocation enum values
  • Refactors directive handling for better maintainability

Changes

  • Enhanced resolve-root-schema to include custom directives from schema
  • Added complete __DirectiveLocation enum values (executable + type system)
  • Refactored with helper functions for directive processing
  • Added comprehensive tests
  • Fixed existing introspection test to include new builtin directives

Test plan

  • Custom directives appear in introspection results
  • Built-in directives still work correctly
  • DirectiveLocation enum includes all standard values
  • Tests pass for directive introspection scenarios

Future improvements

The following items could be addressed in future PRs to improve directive architecture consistency:

  1. Refactor directive definition structure for consistency - Currently directive definitions are scattered across parser (builtin-directives) and schema compilation (compile-directive-defs). This could be unified into a single source of truth.

  2. Consolidate builtin directives across parser and schema compilation - @skip, @include are defined in parser while @deprecated is in schema compilation. All builtin directives should be managed in one place.

  3. Ensure @Skip and @include are properly defined in schema directive-defs - Executable directives should also be included in schema's directive-defs for consistency, rather than being handled separately in parser.

Addresses the documentation note: "custom directives are not identified" in introspection.

@CLAassistant
Copy link

CLAassistant commented Oct 13, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@hlship hlship left a comment

Choose a reason for hiding this comment

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

It's a lot to take in, but the fact that existing tests are unchanged, and the new tests identify what's been added, gives me some confidence.

@hlship hlship added this to the 1.3.0 milestone Oct 17, 2025
@hlship hlship merged commit 82f1f92 into walmartlabs:master Oct 17, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants