gatsby-source-strapi icon indicating copy to clipboard operation
gatsby-source-strapi copied to clipboard

Common GraphQL object type for images

Open mwoelk opened this issue 2 years ago • 1 comments

Currently when a component uses an image, an object type is created in the schema that looks similar to this: STRAPI__COMPONENT_NAMEImage. Even if multiple image fields are used there are many duplicate ObjectTypes with different names created although their schemas are all the same.

It would be great to have them all use the same object type e.g. STRAPI__IMAGE or implement a common GraphQL Interface.

Why? This would make it easier to build queries using fragments. One could define an image component in gatsby that has a fragment on the image type/interface and re-use it all throughout the page.

mwoelk avatar Feb 16 '22 16:02 mwoelk

Just added PR #286 that should solve this issue by simply extracting images into own nodes and linking them (similar to how JSON/Text is handled but with a constant type).

mwoelk avatar Feb 16 '22 20:02 mwoelk