I am using GraphQL to return necessary JSON objects.
I have a defined type called Colour in my server and it is used in multiple different queries. There is one instance where instead of just returning one Colour type by a query such as
query Colour($id: Int!) { colour(id: $id) { hue saturation luminosity red green blue } } I need to return an array of Colour without having to create a new type called Colours on the backend.
I'd need the response to resemble
{ "data": { "colours": [ { "hue": 0, "saturation": 100, "luminosity": 100, "red": 255, "green": 0, "blue": 0 }, { "hue": 0, "saturation": 0, "luminosity": 100, "red": 255, "green": 255, "blue": 255 } ] } } Is there a way I could run one single query over an array of ids to get an object with this shape?