Skip to content

Question: Is there any way to create GraphQL interfaces? #2212

Description

@ossinkine

GraphQL allows to declare abstract types called interfaces (https://graphql.org/learn/schema/#interfaces). On the backed it's mean we can create abstract models.
What is a proper way I should configure my models that API Platform builds a schema with interfaces?

Activity

  1. CvekCoding commented on May 30, 2019

    @CvekCoding
    Contributor

    I explored this slightly. I think this is not possible at this moment. This is how interfaces are implemented in WebOnyx https://webonyx.github.io/graphql-php/type-system/interfaces/
    I see only one one place where interface creates and only for Node type

    public function getNodeInterface(): InterfaceType

    @alanpoulain please confirm. If I'm right do you plan to support interfaces for GraphQl? I think this way data model in GraphQl schema will reflect model in php very well. At this moment I have some troubles with this.

  2. stale commented on Nov 5, 2022

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  3. locked and limited conversation to collaborators on Nov 6, 2022
  4. converted this issue into a discussion #5133 on Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions