Closed pkqk closed 1 year ago
Patch coverage: 100.00
% and project coverage change: +0.07
:tada:
Comparison is base (
eff66a8
) 70.93% compared to head (259157a
) 71.00%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Makes sense! I do think using a structured builder would be a lot safer than string building as it would effectively guarantee well-formed json.
LGTM too, do agree on not manually constructing json strings but it's a refactoring we haven't had the time for yet.
When a response included multiple implementations of an interface type but the query only asked for certain types in the fragment spread invalid json could be generated, as a loop around the serialisation function added in a comma but without any accompanying content.
For this example schema
The query
would end up with invalid JSON for the
Tool
Gizmo
as it would write a,
after theid
field expecting to then go through the fragment and write more values.This changes the
formatResponseDataRec
so that it collects the next value, checks it has content and only writes a,
if it's about to write more data after that. Changing the general logic from write a comma after everything except the last item to, writing a comma before every item after the first one.