Schema Definition Language in GraphQL

When you live with a roommate, it's common to have a rule or contract that helps both of you, you establish rules on who does what chores and what each person is allowed to do. You established a mutually agreeable contract to achieve a peaceful living.

Schema Definition Language is like that contract between the client and server so that both can understand what is possible and capable so it both can co-exist.

How does it work?

  1. Define the Schema : You lay down the structure of the schema of what information you want.
  2. Client Requests : Client (Apollo, Yoga etc) sends the queries or mutation to the server.
  3. Server Parsing : The GraphQL Server parses the request with the contract it has and validates it.
  4. Data Resolution : Server starts gathering the data that is required by traversing the object.
  5. Response : Gives the client the information/data it has gathered.

This is what SDL means in basic terms, it helps in making that communication between the client and server to provide the required response.