smallrye / smallrye-graphql

Implementation for MicroProfile GraphQL
Apache License 2.0
155 stars 89 forks source link

Problems with annotations like nonnull and lists in kotlin #2142

Open robp94 opened 3 weeks ago

robp94 commented 3 weeks ago

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