-
Notifications
You must be signed in to change notification settings - Fork 179
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
Could @GraphQLNonNull be used as an ElementType.METHOD annotation? #91
Comments
I don't think this would actually solve your problem. Even if the annotation itself would be allowed on a method, much of the information would still be lost, due to a bug JetBrains doesn't care to fix. As a result, Kotlin properties simply don't work with Java's If I'd change the annotations, only some cases would start working in Kotlin at the expense of creating long term complications and confusion. So it makes no sense from the project perspective to go there. I'm sorry to say, but with the situation as it is, Kotlin support is currently a non-goal. I'll do what I can to make it compatible where possible, but as long as the bug is there, I can't do all that much without sacrifices bigger than I'm willing to make... |
You can see more discussion and links here. Is it possible to write explicit getters/setters in these cases? |
The scariest part is that the property annotations are inaccessible even to Kotlin's reflection. This bug is even labeled as Major priority, yet with no attention for over a year... |
@kaqqao sorry for the late answer and thank you for taking the time to explain what's happening with Kotlin. We'll write getters/setters manually. |
Interestingly enough, so many people have been complaining about this recently (I like to believe it's because of SPQR) that it finally attracted some attention from JetBrains. We even got a response from the assigned developer saying that he'll try implementing it in the next full release of Kotlin! |
Hey, I've created an example schema transformer that infers nullability information from Kotlin runtime. You can have a look here: https://github.com/alediaferia/graphql-spqr-kotlin-example/blob/master/src/main/kotlin/com/alediaferia/graphql/spqr/kotlin/KotlinTypesSchemaTransformer.kt Have a look at the tests to better understand what it does. @kaqqao let me know if there's anything you want me to include in the example and BTW: awesome work with this library, it's very well organized. |
@alediaferia Thank you for sharing this ❤️ edit: also thanks kaqqao for this awesome lib of course |
Hello, I saw your configuration and improved it a little more. I used your code as a source. So I wrote a configuration like this: SchemaTransformerConfiguration Thanks for sharing :) |
Everything is working great in our project with SPQR except for required fields : we're using Kotlin so getters/setters are generated, which makes it impossible to put the
@GraphQLNonNull
as parameter annotations.Would it be possible to use this annotation as
ElementType.METHOD
?Thanks!
The text was updated successfully, but these errors were encountered: