lighthouse icon indicating copy to clipboard operation
lighthouse copied to clipboard

Usage of relationship directives with pagination on interfaces fails

Open eNzyOfficial opened this issue 3 years ago • 3 comments

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

eNzyOfficial avatar Apr 29 '22 09:04 eNzyOfficial

@olivernybroe this is the same problem you had, right?

spawnia avatar Apr 29 '22 09:04 spawnia

@spawnia exactly 👍

I was just too lazy to create a task for it 😅

olivernybroe avatar Apr 29 '22 11:04 olivernybroe

I have attempted to solve this previously here, but with little success. https://github.com/nuwave/lighthouse/pull/2012 Working with php8 only, would be a breeze though.

vgedzius avatar Oct 23 '22 10:10 vgedzius