Skip to content

extendSchema breaks resolution of fragments on interfaces / unions #1093

@exogen

Description

@exogen

I know extendSchema is undocumented, but it's the only way to accomplish the schema extensions feature I recently added to my library, so I'm reporting this in case someone over there is making extendSchema legit. :)

I've got a query of which this is a part:

{
  target {
    ... on URL {
      resource
    }
  }
}

The target field is of type Entity, which is an interface, and URL implements that interface. When I run this without using extendSchema, I get the expected result:

{
  "target": {
    "resource": "https://www.discogs.com/artist/408531"
  }
}

But when the schema has been run through extendSchema, I get a seemingly impossible result:

{
  "target": {}
}

This result is supposed to be impossible with GraphQL – you can't ever get an empty object. Either it's null, or has at least one field (which could be null).

When I log what's happening in the resolvers, the target resolver is receiving and returning all the correct data. But the URL field resolvers are never run. Somehow running the schema through extendSchema causes this.

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