wasyl
09/09/2021, 1:11 PM__typename
field matches the expected type name from schema
• that the json response doesn’t contain unnecessary fields/objects
?mbonnin
09/09/2021, 1:14 PM__typename
, there's the question of types added on the server after compilation__typename
is unknown doesn't always mean the response is wrongwasyl
09/09/2021, 1:25 PMjq
queries, but it’s a bit error prone exactly in the two cases I mentionedmbonnin
09/09/2021, 1:58 PM{
animal {
species
habitat {
country
}
... on Cat {
meow
habitat {
temperature
}
}
}
}
Test Code:
val testData = buildQueryData {
animal = cat {
species = "Cat"
meow = "meeeeooowww"
habitat = habitat {
country = "France"
temperature = 22.8
}
}
}
buildQueryData
could also be buildQueryJson
too if you still want a Json to enqueue in MockServer or something elsewasyl
09/09/2021, 2:07 PMmbonnin
09/09/2021, 2:08 PMI suppose you’d only know at runtime that something’s missing, right?Most likely yes. We could theorically generate all the code to make it compile-time checked but that might not be worth it
we do fetch jsons from the server the first time we introduce some queryMakes send, that's completely fair. I guess that'd be for users who'd prefer to manually construct their json (as opposed to recording them)
wasyl
09/09/2021, 2:09 PM*Data
instances manually, which we specifically try not to do, opting for testing entire jsons insteadmbonnin
09/09/2021, 2:10 PMwasyl
09/09/2021, 2:10 PMmbonnin
09/09/2021, 2:11 PMresponse.data
partresponse.extensions
, right?wasyl
09/09/2021, 2:13 PM"data"