Repository navigation
feat: Support directives on directive definitions - #99
Open
kay-schecker wants to merge 1 commit into
Open
kay-schecker wants to merge 1 commit into
kay-schecker wants to merge 1 commit into
Conversation
Implements graphql/graphql-spec#1206 from the September 2026 edition: - `DirectiveDefinition` gets a `directives` field, parsed between the arguments and `repeatable` as in the spec grammar. - New `DIRECTIVE_DEFINITION` directive location. - New `extend directive @name @directive` definition (`Definition::DirectiveExtension`). - The schema printer emits all of the above.
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
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.
Implements graphql/graphql-spec#1206, which is part of the September 2026 edition of the spec:
Changes
schema::DirectiveDefinitiongets adirectivesfield. They are parsed between the arguments andrepeatable, following the spec grammar (directive @ Name ArgumentsDefinition? Directives[Const]? repeatable? on DirectiveLocations).DirectiveLocation::DirectiveDefinition(DIRECTIVE_DEFINITION) inas_str,FromStrandis_query.schema::DirectiveExtensionandDefinition::DirectiveExtensionforextend directive @name @directive...(spec section "Directive Extensions"). As with the other extensions, at least one directive is required.directive_directives.graphqlandextend_directive.graphql, plus grammar unit tests (AST shape, position, and the error for an extension without directives).The validation rules from the spec (no direct or indirect self-reference) are not part of this crate, which does no validation.
Breaking changes
DirectiveDefinitionhas a new public field, so code that builds it with a struct literal no longer compiles (DirectiveDefinition::newis unaffected).DefinitionandDirectiveLocationhave new variants, so exhaustive matches on them need a new arm.This needs a minor version bump (0.5.0).
cargo testandcargo fmt --all --checkpass.