Skip to content

Mixins should be exposed as GraphQL Interfaces #1204

@tajakobsen

Description

@tajakobsen

Problem

I create very very large mixins that are used by multiple content types.

When wanting to query these out with GraphQL I can't reuse a fragment, because there is not a common interface between the types.

I have to duplicate 100s of lines in my queries for each content type, which are difficult to maintain.

Solution

Guillotine should generate Interfaces for mixins in the project. The types using the mixins should use the implements keyword to indicate that an interface is being used.

This should allow developers to create fragments that can be used across content types (and components etc.).


Bonus (maybe)

There might be an optimisation here too. But it's a breaking change.

If inside a <form>...</form> there is only one <mixin name="..." /> then the type is that just that interface. Right?

This could mean a shared type/interface can be used, and Guillotine doesn't need to generate duplicate for same-shape types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions