Merging schemas for federation
In this example, we will take three user-related schemas and merge them into one schema. Joining them together will allow the schema consumer to use one system to manage three independent microservices that were developed separately. This process is illustrated here:
Figure 7.2: User schema composition
The first schema manages the user’s profile, the second schema handles the user’s friends, and the third schema is responsible for creating and reading posts on our portal.
First, let’s create the schema for managing the user’s profile:
type User @key(fields: "id"){ id: ID! firstName: String! lastName: String! } type Query{ me: User! getUserById( id: ID!): User } type UserOps{ setProfile(userInput: UserInput!): User } type Mutation{ me: UserOps } input UserInput{ firstName:...