Why is the error happening? I did define the varia...
# kgraphql
m
Why is the error happening? I did define the variables in the query.
I defined LatLng in this way in the schema. It's a class from a different library that has lat and lng attributes. Is it the right way of defining the query variables?
j
seems weird. Is it because of radius is defined as int but you are providing a float?
m
No, I defined it as a Double
But is my way of defining custom types and posting the objects correct?
j
If it's Double on the server, then you'll need to say it's Float when defining your query
on line 1 you have
$radius: Int
which should be
$radius: Float
m
Still no luck ๐Ÿ˜
j
Then it's probably something on the server? How does your
users
resolver look?
m
j
found it
it's because of the fields are non optional but in your query definition it says optional. So to fix you should have this on line 1:
query ($radius: Float!, $location: LatLng!) {
if you tried to run the query you should have recieved this error:
Invalid variable $radius argument type Float, expected Float!
in Kotlin fields are non-nullable by default, but in GraphQL fields are nullable by default. so `Float`(in GraphQL) is the same as `Float?`(in Kotlin) and `Float!`(in GraphQL) is the same as
Float
(in Kotlin)
m
Wow, thanks!! But strangely, the warning still shows
j
yeah, seems weird
where is this GraphQL playground hosted?
m
message has been deleted
j
by the ktor plugin or some other online website?
m
Ktor plugin
localhost
j
Then it should work. I will try and reproduce this locally. wait a minute
๐Ÿ‘๐Ÿผ 1
I tested it locally and am not getting this
could you open up the browser console and say what errors are shown there?
m
message has been deleted
I was asking the same earlier, if I am defining and sending the custom types properly. The error seems to be due to this, as I feared. But now can you help with this?
j
Not sure, as it's hard to really understand the issue here without seeing the full code.
m
This is basically the only code relevant, I believe
j
I think I found the issue here ๐Ÿ™‚ https://github.com/aPureBase/KGraphQL/blob/master/kgraphql/src/main/kotlin/com/apurebase/kgraphql/schema/execution/ArgumentTransformer.kt#L29 As LatLng is a java class and does not have any primary constructor this line throws a null pointer exception
๐Ÿ™‚ 1
This is something that should work, so I will investigate further ๐Ÿ‘
๐Ÿ‘ 1