aPureBase / KGraphQL

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

defaultValue is pasted as `toString()` into the schema #148

Open NikkyAI opened 3 years ago

NikkyAI commented 3 years ago

i configured a qury like so

type<FindAddonsConfig>() {
    description = "wrapper object for passing configurations to findAddons"
}
query("findAddons") {
    resolver { config: FindAddonsConfig ->
        ....
        listOf<String>()
    }.withArgs {
        arg<FindAddonsConfig> {
            name ="config"
            defaultValue = FindAddonsConfig()
        }
    }
}

this broke graphql clients and inspection running the inspection query manually reveals

 "defaultValue": "FindAddonsConfig(gameIdList=null, categoryList=null, gameVersionList=null, idList=null, nameList=null, slugList=null, sectionList=null, statusList=null)"

in the response

my expectation was that this would be json encoded is there a different (typesafe) overload for this i overlooked ?

i am using 0.17.7

jeggy commented 3 years ago

Hi @NikkyAI. By following the §4.5.4, it states that it may return a string value. So I'm interested in which client you are using as it should be valid response?

But as it does say "may", I will keep this issue open, so we can change the response to a "stringified json object" instead of just using .toString().