Kotlin support
See original GitHub issueHi!
Awesome library I love it, I even dropped graphql-java-tools and graphql-spring-boot-started for it.
However, it would be awesome to have Kotlin support in the library. For example, it could automatically pick up annotations like: org.jetbrains.annotations.NotNull
, which tells spqr which field is nullable and which is not.
Right now, I can’t even get the @GraphQLNonNull
annotation to work in Kotlin:
@GraphQLQuery(description = "Logs a user in.")
fun login(@GraphQLArgument(name = "username") username: @GraphQLNonNull String, @GraphQLArgument(name = "password") password: @GraphQLNonNull String): LoginResponse = loginService.login(username, password)
What can go wrong here? Also do you plan to support Kotlin?
My final question would be that, is it possible with this library that I don’t need to specify @GraphQLArgument(name = "username")
in the example mentioned above?
It could automatically infer the name from the name of the variable with the -parameter javac option enabled.
Thanks, Gabor
Issue Analytics
- State:
- Created 6 years ago
- Comments:21 (10 by maintainers)
Top Results From Across the Web
Kotlin Programming Language
Gradle. Gradle is introducing Kotlin as a language for writing build scripts ; Corda. Corda is an open-source distributed ledger platform, supported by...
Read more >Kotlin and Android | Android Developers
Android Studio provides first-class support for Kotlin. It even has built-in tools to help you convert Java-based code to Kotlin. The Show Kotlin...
Read more >Kotlin (programming language) - Wikipedia
Kotlin has support for the web; by compiling to JavaScript (i.e., Kotlin/JS with the classic back-end, is declared stable since version 1.3), while...
Read more >48. Kotlin support - Spring
Spring Boot provides Kotlin support by leveraging the support in other Spring projects such as Spring Framework, Spring Data, and Reactor.
Read more >Announcing Kotlin support for protocol buffers
We're excited to deepen our investment in the Kotlin language with official support for Kotlin in the open source Protocol Buffers project.
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
I’ve published a POC for Kotlin support (it leverages runtime reflection) https://github.com/williamboman/graphql-spqr-kotlin. (I don’t recommend using it for any production code though, but great fit for hobby projects if you want to use Kotlin + graphql-spqr).
For Kotlin 1.3.70+ as mentioned in KT-13228 when added the compiler argument
-Xemit-jvm-type-annotations
then@GraphQLNonNull
works fine.