Is there a way to use a 3rd party annotation (ie, ...
# graphql-kotlin
j
Is there a way to use a 3rd party annotation (ie, one that I can't directly annotate with @GraphQLDirective) as a directive? If not, what would need to get built out to make that possible? (Does @Deprecated just have explicit special handling that makes that one work?)
d
Is there a way to use a 3rd party annotation (ie, one that I can't directly annotate with @GraphQLDirective) as a directive?
no
If not, what would need to get built out to make that possible?
current logic is closely tied to that specific directive so unsure whether we could update it to be more generic you could try adding additional directives using hooks (e.g. something potentially in
didGenerateGraphQLType
or
didGenerateQueryField
)
Does @Deprecated just have explicit special handling that makes that one work?
yes it has special handling as it is one of the built-in directives
j
Ok thanks, that makes sense. Was thinking something like Jackson's mixins could be a way to do it, but probably not worth the amount of work it would be vs just creating another annotation.
s
I think you could get around it with the hooks, but the Kotlin wiring and setup would be better to use and more explicit that this annotation is a schema directive, instead of overriding what the original annotation was meant to be used for
j
Yeah we were looking to use existing dropwizard auth annotations rather than create our own analogues for an auth directive, but not a big deal to create our own