We encode the field name and variables in the query text, e.g. pet____id___v_id: pet(id: $id). This bloats the size of the network request (containing the query text) and the network response.
Solution
Instead, we can (optionally) auto-alias all fields with numbers and letters. e.g.:
Go through all the characters in [0-9a-zA-Z], then start with two digit characters, etc.
The order of the selections in the normalization AST should match the order of the fields in the query text (this is already the behavior.)
At runtime, we can reconstruct the alias for each selection by also going in the same order
Note that even if we persist queries, we still want this, because this will make the network response smaller. (Though how big of an impact that will have needs to be measured!)
This makes debugging more difficult, so this should be controllable via command line parameter. The existing behavior (i.e. with aliases like pet____id___v_id) is good for debugging.
Problem
pet____id___v_id: pet(id: $id)
. This bloats the size of the network request (containing the query text) and the network response.Solution
can become
[0-9a-zA-Z]
, then start with two digit characters, etc.pet____id___v_id
) is good for debugging.Importance