-
Notifications
You must be signed in to change notification settings - Fork 116
Open
Description
Noticed that I hadn't wrote about this yet but it's something I really want from GraphCMS that's missing currently.
It'd be nice to be able to define custom resolvers when fetching data. When you're creating a GQL server you have access to the code so you can write custom resolver logic for individual fields as you need. Since everything is defined via a CMS here you lose out on that power.
Imagine you've got some tiles and someone defined a bunch of images in each one:
{
tiles: [
{
images: [1.jpg, 2.jpg],
columns: 2
},
{
images: [1.jpg, 2.jpg],
columns: 1
},
{
images: [1.jpg, 2.jpg],
columns: 1
},
{
images: [1.jpg, 2.jpg],
columns: 2
},
]
}
When querying you want to grab the correct image based on the columns value. In the server it looks something like:
resolver(tile: Tile) {
return tile.images[tile.columns];
}
But without the ability to define a custom resolver you have to overfetch data and select the correct one on the frontend after wasting bandwidth.
Metadata
Metadata
Assignees
Labels
No labels