apollographql / apollographql/federation
[Federation] Identical Interfaces not allowed
- Dominant language
- TypeScript
- Stars
- 727
- Forks
- 276
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 1
Description
I'm using the latest verion of apollo server and apollo gateway. I've implemented two federated endpoints (in PHP) here:
* https://tatooine-dev-graphql.wmflabs.org/graphql/federation
* https://jakku-dev-graphql.wmflabs.org/graphql/federation
Both of these endpoints use the same code base, but different databases. I've ensured that all of the interfaces are identical, and the objects are namespaced. For instance `MediaWikiRevision` is an interface of a revision that is identical. There is a `TatooineRevision` and a `JakkuRevision` that both implement the identical interface. I've also ensured that the fields on the interface **only** return other interfaces (not objects).
However, when I try to use these in Apollo Gateway I get the following error:
> GraphQLSchemaValidationError: Field "MediaWikiRevision.revid" can only be defined once.
> Field "MediaWikiRevision.parent" can only be defined once.
> Field "MediaWikiRevision.user" can only be defined once.
> Field "MediaWikiRevision.anon" can only be defined once.
> Field "MediaWikiRevision.timestamp" can only be defined once.
> Field "MediaWikiRevision.size" can only be defined once.
> Field "MediaWikiRevision.sha1" can only be defined once.
> Field "MediaWikiRevision.comment" can only be defined once.
> Field "MediaWikiRevision.parsedcomment" can only be defined once.
> Field "MediaWikiRevision.tags" can only be defined once.
> Field "MediaWikiRevision.roles" can only be defined once.
> Field "MediaWikiRevision.slot" can only be defined once.
> Field "MediaWikiRevision.slots" can only be defined once.
> There can be only one type named "MediaWikiRevision".
According to the [docs](https://www.apollographql.com/docs/apollo-server/federation/core-concepts/#value-types) it's totally accaptable to have overlapping types, as long as they are identical. Doing a [google search](https://www.google.com/search?q=Field+can+only+be+defined+once+apollo+federation) for the error reveals this [unanswered stack overflow question](https://stackoverflow.com/q/56861339/864374).
I'm not sure what the problem is, but according to the documentation, this error shouldn't be thrown... am I missing something?
Contributor guide
Research direction
Start by reproducing schema composition with the two linked federation endpoints and compare the generated interface definitions. Trace the gateway's schema validation for duplicate interface fields; done means identical federated interfaces compose without the reported duplicate-field and duplicate-type errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, typescript
- Domain
- api, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100