smallrye-graphql icon indicating copy to clipboard operation
smallrye-graphql copied to clipboard

Problems with annotations like nonnull and lists in kotlin

Open robp94 opened this issue 7 months ago • 0 comments

Follow-up issue of https://github.com/smallrye/smallrye-graphql/issues/1366

There seems to be a discrepancy between client and server

@Query
fun test2(list: List<@NonNull String>): String

@Query
fun test3(list: @NonNull List<@NonNull String>): String

result in schema

test2(list: [String!]!): String test3(list: [String!]!): String

But both test fail with

Variable type '[String!]' doesn't match expected type '[String!]!

I think that both server and client should fit together. Furthermore, test1 is wrong in both client and server, but could be some kotlin problem.

@Query
fun test1(list: @NonNull List<String>): String

Graphql:

test1(list: [String]): String

Note kotlin is a bit special with annotations https://youtrack.jetbrains.com/issue/KT-35843 we need an extra flag. The reproducer uses a quarkus snapshot based on this pr https://github.com/smallrye/smallrye-graphql/pull/2141 code-with-quarkus-nonnull-kotlin.zip

robp94 avatar Jul 03 '24 13:07 robp94