feat: Support federation v2 directives #43
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.
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 supergraphTask 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@externaland@extends.Directive Enhancements:
directives.go: DefinedAllDirectivesandFederationDirectivesvariables to include Federation v2 directives. Added detailed descriptions for@externaland@extendsdirectives. [1] [2]Testing Improvements:
directives_test.go: Added tests for@externaland@extendsdirectives, verifying their names, descriptions, locations, and arguments. Also tested the inclusion of all Federation directives inFederationDirectives.sdl_parser_test.go: Added tests to ensure correct parsing of Federation directives and their usage in SDL, including validation of@externaland@extendsdirectives on fields and types.