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?
- Define the Schema : You lay down the structure of the schema of what information you want.
- Client Requests : Client (Apollo, Yoga etc) sends the queries or mutation to the server.
- Server Parsing : The GraphQL Server parses the request with the contract it has and validates it.
- Data Resolution : Server starts gathering the data that is required by traversing the object.
- 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.