https://kotlinlang.org logo
Title
m

manlan

07/29/2020, 6:56 PM
Sorry, couldn't find it anywhere in the docs, hence asking here
j

jeggy

07/29/2020, 8:34 PM
By calling
inputType<Address>()
now this will be included as a input type in your schema. KGraphQL will also automatically pick up_(so no need to specify it with the
inputType
)_ any input types that you provide to your resolvers. Easiest way is to just provide it directly to your resolver like this
query("locationData") {
  resolver { address: Address ->
    println(address.city)
    ...
  }
}
Example within the docs are here: https://kgraphql.io/Reference/resolver/#arguments
m

manlan

07/30/2020, 9:59 AM
I did exactly this. So how do I pass a custom object like this to the query? In GraphiQL?
j

jeggy

08/04/2020, 10:29 PM
sorry for late response.
But let's say you have this setup. Then you can write this query:
mutation {
  locationData(address: { city: "Hometown", zipCode: "600" })
}
👍 1
m

manlan

08/07/2020, 2:30 AM
Thank you, it worked