apollographql / federation

🌐  Build and scale a single data graph across multiple services with Apollo's federation gateway.
https://apollographql.com/docs/federation/
Other
666 stars 251 forks source link

Interfaces implementing interfaces #227

Open MerzDaniel opened 4 years ago

MerzDaniel commented 4 years ago

Interface implements Interface of Graphql 15 syntax is not working

We found this issue when trying to implement our type system into graphql. We've got a big set types inheriting properties from common ancestors and all of the ancestors need a common interface so they can be queried.

Expected Behavior

Creating multi inheritance interfaces are working as described in the Graphql spec.

Actual Behavior

When trying to create an interface that implements an interface buildFederatedSchema fails with the error "Error: Schema must contain uniquely named types but contains multiple types named XXX".

Affected version

Minimal runnable reproduction

The following type definition fails when creating the federated schema. "Error: Schema must contain uniquely named types but contains multiple types named A"

const { buildFederatedSchema } = require('@apollo/federation')
const { gql } = require('apollo-server-express')

const typeDefs = gql`
  interface A { text: String }
  interface B implements A { text: String number: Int} 
`

const resolvers = {}

buildFederatedSchema([{ typeDefs, resolvers }])

A repository show casing the issue can be found here: https://github.com/MerzDaniel/apollo-federation-if-impl-if Just run npm i && npm start

PR introducing the feature

https://github.com/apollographql/federation/pull/30

nikolayandr commented 3 years ago

Is this issue solved now according to closed provided PR?

teovillanueva commented 2 years ago

Hey! quick question! Is this fixed?