question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi!

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:closed
  • Created 6 years ago
  • Comments:21 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
williambomancommented, Oct 10, 2019

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).

0reactions
stengvaccommented, Jul 24, 2020

For Kotlin 1.3.70+ as mentioned in KT-13228 when added the compiler argument -Xemit-jvm-type-annotations then @GraphQLNonNull works fine.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found