right now, the generated mutation queries select all the fields selected at that location. For example, in the following field, the generated mutation query will select (at least) name and best_friend:
field Pet.BestFriendUpdater {
set_best_friend
name
best_friend {
name
}
}
However, if set_best_friend only changes the best_friend, we're overfetching the name!
The task
We should add a new field to pub struct ExposeFieldDirective, something like mutation_selection_set_allow_list: Vec<SelectableFieldName> (or please, think of a better name!) which limits what fields we select.
It should result in fewer fields being selected in the generated mutation query, and fewer fields showing up in the generated normalization AST
name
andbest_friend
:set_best_friend
only changes thebest_friend
, we're overfetching the name!The task
pub struct ExposeFieldDirective
, something likemutation_selection_set_allow_list: Vec<SelectableFieldName>
(or please, think of a better name!) which limits what fields we select.id
should always be selectedFeel free to break this up into multiple PRs.