{
f: friends {
name
}
f: friends {
id
}
}
#=>
{
f: friends {
name
id
}
}
But nested field fragment merging is a nightmare. I'm not going to do it anytime soon.
Basically, figuring out that ...info generates Relationships which contains the field friends which gets merged into friends in the top level query is just a horrible thing to deal with in the current design.
fragment home on Human {
home: homePlanet
planet: homePlanet
}
fragment dimensions on Human {
height
mass
}
fragment relationships on Human {
friends {
name
}
starships {
name
length
}
}
fragment info on Human {
...dimensions
...home
}
query HeroForEpisode($ep: Episode!) {
hero(episode: $ep) {
# without typename we can't really tell which fragments to parse
__typename
name
... on Droid {
primaryFunction
}
... on Human {
friends {
name
id
}
appearsIn
...info
...relationships
}
}
}
I've handled regular field merging
But nested field fragment merging is a nightmare. I'm not going to do it anytime soon.
Basically, figuring out that
...info
generatesRelationships
which contains the fieldfriends
which gets merged intofriends
in the top level query is just a horrible thing to deal with in the current design.