-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Improve clarity of built-in directives #633
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
Changes from 6 commits
27e7720
cecf7fd
37df075
14a8c0f
cfe4e35
f5cd6ba
f0c1fb7
b9b2b75
f485d89
4e28da2
ca86b8b
706332e
8534913
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1644,12 +1644,6 @@ A GraphQL schema describes directives which are used to annotate various parts | |||||||||
of a GraphQL document as an indicator that they should be evaluated differently | ||||||||||
by a validator, executor, or client tool such as a code generator. | ||||||||||
|
||||||||||
GraphQL implementations should provide the `@skip` and `@include` directives. | ||||||||||
|
||||||||||
GraphQL implementations that support the type system definition language must | ||||||||||
provide the `@deprecated` directive if representing deprecated portions of | ||||||||||
the schema. | ||||||||||
|
||||||||||
Directives must only be used in the locations they are declared to belong in. | ||||||||||
In this example, a directive is defined which can be used to annotate a field: | ||||||||||
|
||||||||||
|
@@ -1692,6 +1686,20 @@ While defining a directive, it must not reference itself directly or indirectly: | |||||||||
directive @invalidExample(arg: String @invalidExample) on ARGUMENT_DEFINITION | ||||||||||
``` | ||||||||||
|
||||||||||
**Built-in Directives** | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like the confusion is specifically about introspection, so additional clarity should be added to that section rather than including a new sub-section here. Currently this section seems to mostly just repeat the content from the existing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm also concerned about "built-ins" becoming an ambiguous term here since the directives defined are not all required to be provided by a service. I'd prefer either "The directives specified by this document" as representing the full set of non-custom directives, or something like "directives specified by this document and provided by a GraphQL service" if referring to the subset actually supported There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My implementation of schema introspection add type __Schema {
description: String
types(includeBuiltin: Boolean = false): [__Type!]!
queryType: __Type!
mutationType: __Type
subscriptionType: __Type
directives(includeBuiltin: Boolean = false): [__Directive!]!
} my implementation is able to query the introspection schema itself, that's why I added those params. to avoid confusion for new users. |
||||||||||
|
||||||||||
GraphQL implementations should provide the `@skip` and `@include` directives. | ||||||||||
When returning the set of directives from the `__Schema` introspection type, both | ||||||||||
IvanGoncharov marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
`@skip` and `@include` directives must be included. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since They should be present in introspection if the service supports them. |
||||||||||
|
||||||||||
GraphQL implementations that support the type system definition language must | ||||||||||
provide the `@deprecated` directive if representing deprecated portions of | ||||||||||
the schema, in this case `@deprecated` directive may be included when returning | ||||||||||
the set of directives from the `__Schema` introspection type. | ||||||||||
|
||||||||||
When representing a GraphQL schema using the type system definition language, | ||||||||||
both `@skip`, `@include` and `@deprecated` directives can be omitted for brevity. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since now we have definition for
Suggested change
Also, I checked #597 and says:
So I think you were right initially and we should use
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||
|
||||||||||
**Validation** | ||||||||||
|
||||||||||
1. A directive definition must not contain the use of a directive which | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this section needs to be removed