nuwave / nuwave/lighthouse

Usage of relationship directives with pagination on interfaces fails

Open
#2,133 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
3.5k
Forks
468
Avg merge
3h 9m
Merged PRs (30d)
2

Description

Describe the bug

I tried to create a BaseUser interface, which in this example has many permissions, this causes an error to happen. I believe the schema may get generated incorrectly.

Expected behavior/Solution

Schema should generate correctly?

Steps to reproduce

interface Test {
    relationship: [Relationship!] @belongsToMany(type: CONNECTION)
}

type TestConcrete implements Test {
    relationship: [Relationship!] @belongsToMany(type: CONNECTION)
}

type Relationship {
    id: ID
}

Use this as your schema and you'll get an error

Output/Logs

Click to expand
{
  "error": "Invalid schema Error:\nInterface field Test.relationship expects type [Relationship!] but TestConcrete.relationship is type RelationshipConnection.\nObject field TestConcrete.relationship includes required argument first that is missing from the Interface field Test.relationship."
}

Lighthouse Version

Latest

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction schema in the issue and inspect the reported GraphQL schema validation error for the interface and implementing type. Trace relationship directives with CONNECTION pagination on interfaces, then verify that schema generation succeeds and the interface and object field types and arguments agree.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, laravel, php
Domain
api, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.