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

__DirectiveLocation for directives #818

Open
sungam3r opened this issue Feb 1, 2021 · 3 comments
Open

__DirectiveLocation for directives #818

sungam3r opened this issue Feb 1, 2021 · 3 comments

Comments

@sungam3r
Copy link
Contributor

sungam3r commented Feb 1, 2021

I propose to add one more location into __DirectiveLocation enumeration: DIRECTIVE_DEFINITION. Relates to #300. Logically, nothing prevents directives from being applied to the directives themselves. Of course, parser support is required.

directive @important on DIRECTIVE_DEFINITION
directive @statusquo on FIELD_DEFINITION @important


type User {
  id: ID!
  name: String @statusquo
  admin: Boolean!
}

type Query {
  user: User
}
@peldax
Copy link

peldax commented Mar 24, 2021

Hi, I agree with your proposal 👍.

One simple note, isn't DIRECTIVE_DEFINITION more suitable in this case? Although directives cannot be applied to "directive usages" in executable document (at least not without some new additional syntax), I think its good idea to explicitly state its meant only to definitions.

@sungam3r
Copy link
Contributor Author

Of course it is. Changed.

@martinbonnin
Copy link
Contributor

martinbonnin commented Sep 26, 2024

2 use cases:

Opt-in markers:

directive @optIn

# optIn usage defines @experimentalDeploymentApi as an opt-in marker
directive @experimentalDeploymentApi @optIn

Identifying client side directives:

directive @client
directive @catch @client

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants