Skip to content
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

Improve clarity of built-in directives #633

Merged
merged 13 commits into from
Apr 26, 2021
Merged

Conversation

sungam3r
Copy link
Contributor

fixes #632
relates to #597

@IvanGoncharov IvanGoncharov added the ✏️ Editorial PR is non-normative or does not influence implementation label Oct 27, 2019
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since now we have definition for built-in directives it's better to use it:

Suggested change
both `@skip`, `@include` and `@deprecated` directives can be omitted for brevity.
built-in directives can be omitted for brevity.

Also, I checked #597 and says:

all built-in scalars must be omitted for brevity.

So I think you were right initially and we should use must for consistency.
Sorry for the confusion 🤦‍♂

Suggested change
both `@skip`, `@include` and `@deprecated` directives can be omitted for brevity.
built-in directives must be omitted for brevity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should is used in the scalars section, so here I used it too

@sungam3r
Copy link
Contributor Author

sungam3r commented Nov 7, 2019

Anything else to fix?

@sungam3r
Copy link
Contributor Author

sungam3r commented Dec 3, 2019

bump

Comment on lines 1647 to 1883
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.

Copy link
Collaborator

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


GraphQL implementations should provide the `@skip` and `@include` directives.
When returning the set of directives from the `__Schema` introspection type, both
`@skip` and `@include` directives must be included.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since @skip and @include directives only should be provided, a service can omit them, if for some reason its executor cannot handle them.

They should be present in introspection if the service supports them.

@@ -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**
Copy link
Collaborator

Choose a reason for hiding this comment

The 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 @skip, @include and @deprecated sections. As we add additional directives over time we should avoid having too many places we need to edit to expand that list.

Copy link
Collaborator

Choose a reason for hiding this comment

The 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

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My implementation of schema introspection add includeBuiltin param for types and directives fields. It's up to the user whether he want to query builtin types/directives or not.

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.

@leebyron leebyron added the 🤷‍♀️ Ambiguity An issue/PR which identifies or fixes spec ambiguity label Jan 10, 2020
Base automatically changed from master to main February 3, 2021 04:50
@leebyron leebyron added this to the May2021 milestone Apr 6, 2021
@leebyron
Copy link
Collaborator

I've added some changes that addressed my earlier review. @sungam3r I'd love your final look at this

@leebyron leebyron requested review from leebyron, IvanGoncharov and a team April 22, 2021 17:58
@leebyron leebyron requested a review from a team April 22, 2021 17:59
@leebyron leebyron changed the title Improve clarity of standard directives Improve clarity of built-in directives Apr 22, 2021
@sungam3r
Copy link
Contributor Author

Thanks @leebyron . Only 3 minor comments.

Co-authored-by: Ivan Maximov <sungam3r@yandex.ru>
@leebyron leebyron force-pushed the main branch 4 times, most recently from e5d241d to 6c81ed8 Compare April 23, 2021 19:15
@leebyron leebyron merged commit debcdc3 into graphql:main Apr 26, 2021
@sungam3r sungam3r deleted the directives branch April 27, 2021 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤷‍♀️ Ambiguity An issue/PR which identifies or fixes spec ambiguity ✏️ Editorial PR is non-normative or does not influence implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Standard directives question
6 participants