https://kotlinlang.org logo
#graphql-kotlin
Title
# graphql-kotlin
j

Jesper Hasselström

12/07/2019, 11:47 AM
Hello! We are currently experimenting with migrating our GraphQL app based on Kotlin with graphql-java-tools, to graphql-kotlin. We ran into an issue just now. We have a query that takes
ids:List<String>?
as an argument. When creating our schema we get an error:
Copy code
Exception in thread "main" com.expediagroup.graphql.exceptions.InvalidInputFieldTypeException: Argument cannot be an interface or a union, parameter #1 ids of fun <X>.query(kotlin.collections.List<kotlin.String>?, kotlin.String?, kotlin.collections.List<kotlin.String>?): kotlin.collections.List<X>
How can this be solved?
Using an Array of Strings might be the best option I guess, but it would’ve been nice if the lib could automatically do that type conversion.
Or by solving it with some Scalar-stuff but that feels a bit awkward
Btw, we got reeeally far in just a few hours! Really liking the library! And it worked fine without Spring like we discussed in person at KotlinConf yesterday.
s

Shane Myrick

12/07/2019, 8:38 PM
@Jesper Hasselström You are correct, that for input, the type must be a concrete class and not an interface. So the work around here is to use `Array`s. I have create a new issue though to discuss this further and maybe track the addition of your feature request: https://github.com/ExpediaGroup/graphql-kotlin/issues/509
j

Jesper Hasselström

12/08/2019, 9:14 AM
Thanks for getting back to me! I’ll bring this up with the team on Monday. Cheers!
6 Views