-
Notifications
You must be signed in to change notification settings - Fork 353
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
[generator] support repeatable directives #590
Comments
We should wait until support is added in graphql-java before we support this in our library: graphql-java/graphql-java#1763 |
The GraphQL spec does now support repeatable directives but we are tracking support here: #590
The GraphQL spec does now support repeatable directives but we are tracking support here: #590
Issue seems to be resolved in 16.0 Any progess on this planned? |
I just looked into this and while Suggested workaround of using some wrapper annotation won't work as annotations do not extend other annotations so we won't be able to pass instances of custom directives. annotation class GraphQLRepeatableDirectives(
val directives: Array<GraphQLDirective>
)
@GraphQLRepeatableDirectives(
directives = [CustomDirective("foo")] // type mismatch
)
class Foo(val bar: String) Based on the above I am unsure whether we will be able to support repeatable directives until https://youtrack.jetbrains.com/issue/KT-12794 is resolved or we move away from annotations. |
Ok, this was not the answer I expected. But the answer is clear.
Might I suggest a different approach work around?
Currently we have:
annotation class KeyDirective(val fields: FieldSet)
What if to support multiple Key directives in the code we replace this with:
annotation class KeyDirective(val fields: Array<FieldSet>)
With this approach we circumvent the repeatable annotations but get the information I a contained manner to the code base.
Pieter
…On 22 Jan 2021, 21:28 +0100, Dariusz Kuc ***@***.***>, wrote:
I just looked into this and while graphql-java does support repeatable directives, unfortunately Kotlin still does not support repeatable annotations with RUNTIME retention (see https://youtrack.jetbrains.com/issue/KT-12794). We need RUNTIME retention on the directive annotations so we can access them using reflections.
Suggested workaround of using some wrapper annotation won't work as annotations do not extend other annotations so we won't be able to pass instances of custom directives.
annotation class GraphQLRepeatableDirectives(
val directives: Array<GraphQLDirective>
)
@GraphQLRepeatableDirectives(
directives = [CustomDirective("foo")] // type mismatch
)
class Foo(val bar: String)
Based on the above I am unsure whether we will be able to support repeatable directives until https://youtrack.jetbrains.com/issue/KT-12794 is resolved or we move away from annotations.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Any update on this? @elucidator's suggestion to have an |
According to Kotlin Roadmap they will be tackling KT-12794 in the next couple months. Proposed solution of using |
Kotlin 1.6 provides support for repeatable annotations with `RUNTIME` retention. This allows to finally support repeatable directives. Related Issues: * resolves ExpediaGroup#590 * depends on ExpediaGroup#1358
Kotlin 1.6 provides support for repeatable annotations with `RUNTIME` retention. This allows to finally support repeatable directives. In order to make your directives repeatable, you need to annotate it with `kotlin.annotation.Repeatable` annotation. ```kotlin @repeatable @GraphQLDirective annotation class MyRepeatableDirective(val value: String) ``` Generates the above directive as ```graphql directive @myRepeatableDirective(value: String!) repeatable on OBJECT | INTERFACE ``` Related Issues: * resolves ExpediaGroup#590 * depends on ExpediaGroup#1358
Kotlin 1.6 provides support for repeatable annotations with `RUNTIME` retention. This allows to finally support repeatable directives. In order to make your directives repeatable, you need to annotate it with `kotlin.annotation.Repeatable` annotation. ```kotlin @repeatable @GraphQLDirective annotation class MyRepeatableDirective(val value: String) ``` Generates the above directive as ```graphql directive @myRepeatableDirective(value: String!) repeatable on OBJECT | INTERFACE ``` Related Issues: * resolves ExpediaGroup#590 * depends on ExpediaGroup#1358
Kotlin 1.6 provides support for repeatable annotations with `RUNTIME` retention. This allows to finally support repeatable directives. In order to make your directives repeatable, you need to annotate it with `kotlin.annotation.Repeatable` annotation. ```kotlin @repeatable @GraphQLDirective annotation class MyRepeatableDirective(val value: String) ``` Generates the above directive as ```graphql directive @myRepeatableDirective(value: String!) repeatable on OBJECT | INTERFACE ``` Related Issues: * resolves ExpediaGroup#590 * depends on ExpediaGroup#1358
Kotlin 1.6 provides support for repeatable annotations with `RUNTIME` retention. This allows to finally support repeatable directives. In order to make your directives repeatable, you need to annotate it with `kotlin.annotation.Repeatable` annotation. ```kotlin @repeatable @GraphQLDirective annotation class MyRepeatableDirective(val value: String) ``` Generates the above directive as ```graphql directive @myRepeatableDirective(value: String!) repeatable on OBJECT | INTERFACE ``` Related Issues: * resolves #590 * depends on #1358
The GraphQL spec does now support repeatable directives but we are tracking support here: ExpediaGroup#590
Kotlin 1.6 provides support for repeatable annotations with `RUNTIME` retention. This allows to finally support repeatable directives. In order to make your directives repeatable, you need to annotate it with `kotlin.annotation.Repeatable` annotation. ```kotlin @repeatable @GraphQLDirective annotation class MyRepeatableDirective(val value: String) ``` Generates the above directive as ```graphql directive @myRepeatableDirective(value: String!) repeatable on OBJECT | INTERFACE ``` Related Issues: * resolves ExpediaGroup#590 * depends on ExpediaGroup#1358
Is your feature request related to a problem? Please describe.
GraphQL spec now supports repeated directives.
graphql-kotlin-schema-generator
should support it as well.Describe the solution you'd like
graphql-kotlin-schema-generator
should be able to generate a schema with fields that have repeated directives.Describe alternatives you've considered
N/A
Additional context
GraphQL spec PR: graphql/graphql-spec#472
The text was updated successfully, but these errors were encountered: