DEV Community

Discussion on: Enhancing GraphQL Schemas with Interfaces

 
mikemeerschaert profile image
mikemeerschaert • Edited

Thanks for the reply! This is actually exactly how I ended up implementing my schema! I have a file called CombinationTypes that defines all the different permutations of combined interfaces. When new combos are needed it's as simple as adding them to the schema since the interfaces already have the resolvers mapped to them. I have a "base" interface (like you have here with employee) that every combination type implements, and then I have a json object that maps possible values of fields on the base interface to all the various combo types. It's not in production yet, but it actually works very well.

Thread Thread
 
jaxolotl profile image
Javier Valderrama (Jax)

Maybe I'm not getting it right, but it sounds to me as something you might achieve in a more GraphQL style by using Federation, Schema Composition and Apollo Gateway.

Here a link to the documentation and 2 excellent videos

apollographql.com/docs/apollo-serv...

youtube.com/watch?v=v_1bn2sHdk4

youtube.com/watch?v=OFT9bSv3aYA

I hope you find this useful.