Add Resolvers for GraphQL

I’ve only been using DatoCMS for a short time, but one big pain point that I’ve come across is that I can’t write resolvers for certain data types. I imagine this is by design to keep the DatoCMS interface → GraphQL → Consuming Component as simple as possible.

But having to then mutate the data on the FE, checking for the first array value when you only want a singleton, lots of if’s and conditionals checking between externalUrls or internal stored files can get a bit tedious.

Is this something that DatoCMS might support in the future?

Hi! Could you please elaborate a bit more what are the exact points in which you need a lot of conditionals? I’m not sure I understand what you mean with “externalUrls or internal stored files” :confused:

Btw, for Single Instance models, instead of using allBlogPosts you can query using blogPost which returns the singleton, and not an array!