-
Notifications
You must be signed in to change notification settings - Fork 2k
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
How to set directives for fields when creating GraphQLObjectType? #1262
Comments
@nodkz It was already discussed in my PR that added
Also, I think this question is connected to the topic discussed on the last WG: Exposing schema metadata. So I think we should decide what we expose through introspection(directives or something else) and then add the same thing to |
Yeah - I stand by that comment. You can include any arbitrary data on a GraphQLObjectType that you like - it's just a JS object after all. Directives are a language-level feature, not a structural property of a type. Typically tools which use directives in the SDL are adding properties to the created underlying type objects to track within their runtimes. |
Can somebody share proper way how to pass
directives
for fields when creating type viaGraphQLObjectType
? I want to integrate graphql-cost-analysis to our GraphQL Schema.A astNode: FieldDefinitionNode in
GraphQLFieldConfig
is ReadOnly and there is now way to write directives via object config. Or i something missing?Desired way to declare directive will be such:
cc @IvanGoncharov @leebyron
The text was updated successfully, but these errors were encountered: