Part 9 - Interfaces & Polymorphism
This is part 9 of this series
We continue with the next chapter in the official Relay’s Newsfeed example: GraphQL Types, Interfaces, and Polymorphism | Relay
This is very straightforward chapter. We do not need to make any changes on server side. What we have implemented just works.
This simplicity is made possible by Relay’s schema. Recall that when you make changes in your GraphQL types on the server side, you need to run a command to generate schema.graphql
. This schema.graphql
is also referenced on the client side and used by relay compiler to enforce typing consistency.
Enforcing typing consistency between server and client is often solved by a DSL. Most common ones are protocol buffer (or protobuf) from Google, and thrift from Facebook. The GraphQL DSL is used similar in this case. It keeps the types used on your server and client consistent.
Any the commit diff for this chapter is https://github.com/tuan/newsfeed-demo-app/commit/85124691fadb6d7608b5d4e6c9aacff9402c6b8e.