Directive arguments support @GraphQLIgnore
See original GitHub issueCreating a new directive with an ignored field will prevent the schema from being generated when the ignored field type is not in the supported packages. Is there a way to prevent this behavior? It seems like a type that is only referred to in an ignored field should not break schema generation even if it is not in the supported packages.
Example in a directive:
@GraphQLDirective()
annotation class TestDirective(
val value: String,
@GraphQLIgnore
val ignore: Array<KClass<*>> = []
)
Results in
Caused by: com.expediagroup.graphql.exceptions.TypeNotSupportedException: Cannot convert kotlin.reflect.KClass<*> since it is not a valid GraphQL type or outside the supported packages [...]
Obviously something like kotlin.reflect should not be added to the supported packages and nothing representing KClass should be in the schema.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Directives - Apollo GraphQL Docs
Directives · Configure GraphQL types, fields, and arguments · Valid locations · Default directives · Custom directives · Directives · Community · Company...
Read more >Directives | GraphQL Kotlin
GraphQL directives can be used to transform the schema types, fields and arguments as well as modify the runtime.
Read more >Field arguments vs. directives in GraphQL - LogRocket Blog
In conclusion, only field arguments can help retrieve the data that resolves the field. Applying functionality via field arguments or directives.
Read more >Schema Directives – GraphQL Tools
Using and implementing custom directives to transform schema types, fields, and arguments.
Read more >leangen/graphql-spqr - Gitter
I've got minor issue and i believe you can help me. ... to manipulate the schema elements that SPQR produces internally (fields, arguments...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@oatmeal-raisin From what I can tell there is no way to get the argument annotation information from a directive during schema generation unless you know the specific class type. So the best way to solve this is just with the hooks.
See the PR for more details https://github.com/ExpediaGroup/graphql-kotlin/pull/763
Thanks @smyrick and @dariuszkuc. I really appreciate how responsive your team is and I am looking forward to the enhancement. Are there any hooks I can take a look at that do something similar? I will need to both exclude the field and to prevent the type on that ignored field from causing an exception because it is not in the configured packages.