aPureBase / KGraphQL

Pure Kotlin GraphQL implementation
https://kgraphql.io
MIT License
301 stars 58 forks source link

Provide better error reporting for incorrect input #93

Closed jeggy closed 4 years ago

jeggy commented 4 years ago

Currently this setup throws this exception: java.lang.UnknownError: Something went wrong while searching for the constructor parameter type

data class MyInput(val value1: String)

val schema = KGraphQL.schema {
    query("main") {
        resolver { input: MyInput -> "${input.value1}!!!"}
    }
}

schema.executeBlocking("""
    {
        main(input: { valu1: "Hello" })
    }
""".trimIndent()).let(::println)

It should throw a better error than just a UnknownError with no helpful message.

Allali84 commented 4 years ago

What about GraphQLError: Constructor Parameter 'valu1' can not be found in 'MyInput' ?

jeggy commented 4 years ago

Sounds good 😃

jeggy commented 4 years ago

Has been solved and released in version 0.15.2