Skip to content

Conversation

@Mistat
Copy link
Contributor

@Mistat Mistat commented Jun 18, 2025

Issue

Support federation v2 directives

TL; DR

Available Federation v2 directives:

  • @external - Marks a field as owned by another service
  • @extends - Allows extending types from other services
  • @requires - Specifies required fields for resolution
  • @provides - Specifies fields that will be provided
  • @key - Defines entity keys
  • @shareable - Allows fields to be resolved by multiple services
  • @override - Takes responsibility for a field from another service
  • @inaccessible - Marks fields as inaccessible to consumers
  • @link - Links to external schemas
  • @composeDirective - Preserves custom directives in supergraph

Task summary / Change details

This pull request introduces GraphQL Federation v2 support to the library, adding new directives and enhancing schema capabilities. Key changes include the implementation of Federation v2 directives, updates to directive definitions, and extensive testing to ensure compatibility and correctness.

Federation v2 Support:

  • README.md: Added documentation and examples for using Federation v2 directives, including @external and @extends.

Directive Enhancements:

  • directives.go: Defined AllDirectives and FederationDirectives variables to include Federation v2 directives. Added detailed descriptions for @external and @extends directives. [1] [2]

Testing Improvements:

  • directives_test.go: Added tests for @external and @extends directives, verifying their names, descriptions, locations, and arguments. Also tested the inclusion of all Federation directives in FederationDirectives.
  • sdl_parser_test.go: Added tests to ensure correct parsing of Federation directives and their usage in SDL, including validation of @external and @extends directives on fields and types.

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