Open
Description
Hey!
I think it would be awesome to have methods to copy nested fragment data to the current builder.
My use case is to create a lot of mocks that could import one another for easier maintenance.
But without the possibility to use a fragment data inside a query data builder, it makes this a lot more complicated.
Here is an example (notice the fromHumanFrag
method):
fragment HumanFrag on Human {
id
birthday
height(unit: METER)
}
query HumanQuery($id: ID!) {
human(id: $id) {
...HumanFrag
}
}
test('can serialize and deserialize responses with nested fragment', () {
final human = GHumanFragData((b) => b
..id = '123'
..height = 180.0
..birthday = DateTime(2021, 1, 1));
final res = GHumanQueryData((b) => b
..human.fromHumanFrag(human));
final json = res.toJson();
final resFromJson = GHumanQueryData.fromJson(json);
expect(res, resFromJson);
});
Metadata
Metadata
Assignees
Labels
No labels