-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Proposed change to directive location introspection #152
Merged
Conversation
This file contains 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
This proposes a change to how we represent the ability to validate the locations of directives via introspection. Specifically, this *removes* `onField`, `onFragment`, and `onOperation` in favor of `locations` which is a list of `__DirectiveLocation`. In addition, this changes the specification of the `@skip` and `@include` directives to no longer allow their use on fragment directives (but are still allowed on fragment spreads and inline fragments). Because of this, a section on "merging fragment directives" is no longer useful. **Rationale:** This allows for a more fine-grained validation of directive placement, now you can assert that a directive is allowed on queries but not mutations, or allowed on fragment definitions but not on fragment spreads. Also, this makes expanding the locations a directive is allowed to be placed easier to do, as future expansions will not affect the introspection API. This should be considered a prereq to supporting directives in more locations. Finally, this is a prereq to a forthcoming RFC to add directives to the type schema language, one of the last missing pieces to represent a full schema using this language. **Drawbacks:** Any change to the introspection API is a challenge. Tools like Graph*i*QL should continue to support the older representation if possible.
leebyron
force-pushed
the
fine-grain-directives
branch
from
March 19, 2016 00:44
99e4699
to
1c38e6a
Compare
leebyron
added a commit
that referenced
this pull request
Mar 22, 2016
[RFC] Proposed change to directive location introspection
This was referenced Apr 21, 2016
kliuless
added a commit
to tribune/graphql-ruby
that referenced
this pull request
Apr 21, 2016
See graphql/graphql-spec#152 This is temporary until GraphiQL is updated.
kliuless
added a commit
to tribune/graphql-ruby
that referenced
this pull request
Apr 25, 2016
See graphql/graphql-spec#152 This is temporary until GraphiQL is updated.
andimarek
added a commit
to graphql-java/graphql-java
that referenced
this pull request
May 19, 2020
@leebyron we just removed these fields from graphql java: 3,5 years after this PR ;-) |
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.
This specifies graphql/graphql-js#317
This proposes a change to how we represent the ability to validate the locations of directives via introspection.
Specifically, this removes
onField
,onFragment
, andonOperation
in favor oflocations
which is a list of__DirectiveLocation
.In addition, this changes the specification of the
@skip
and@include
directives to no longer allow their use on fragment directives (but are still allowed on fragment spreads and inline fragments). Because of this, a section on "merging fragment directives" is no longer useful.Rationale:
This allows for a more fine-grained validation of directive placement, now you can assert that a directive is allowed on queries but not mutations, or allowed on fragment definitions but not on fragment spreads.
Also, this makes expanding the locations a directive is allowed to be placed easier to do, as future expansions will not affect the introspection API. This should be considered a prereq to supporting directives in more locations.
Finally, this is a prereq to a forthcoming RFC to add directives to the type schema language, one of the last missing pieces to represent a full schema using this language.
Drawbacks:
Any change to the introspection API is a challenge. Tools like Graph_i_QL should continue to support the older representation if possible.