I am working with the Java Client, to be honest, I don’t like it. Working with GraphQL is a mess. Especially parsing the response is bad. I have to manually inspect the response, work my way through Maps. Not nice, but it seems to work.
One thing I do not understand is that I get back Doubles, while the type is int. No idea what I am doing wrong, or can change.
Yes, you’re right that Java client should have a better way of serializing the GraphQL response. I will try to experiment with a better generic GraphQL object which would ease the way how we now handle GraphQL responses.
One thing I do not understand is that I get back Doubles, while the type is int. No idea what I am doing wrong, or can change.
Java client uses Gson for serialization / deserialization. I think that by default Gson deserializes numbers into Doubles and that’s why you are observing such a behaviour. I think that the only thing that you can try to do with this behaviour is to deserialize and then serialize the response to your typed Class that has a proper type definition on that given property, so that it will get eventually serialized to an int (not to Double)