GraphQL Types & Schema
You might have heard about #GraphQL. We plan on doing a few different posts on GraphQL but first let’s dig into what it is and then go into the first topic we want to cover which is a GraphQL schema and its types. From the docs, “GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data”. This allows you to only specify what you want in a query and get exactly that back. The benefits of GraphQL schema and types is that you know exactly what data you have available and exactly the type of that data.
GraphQL has a few types that are supported out of the box:
GraphQL introduced its own human readable schema syntax which is called “Schema Definition Language” also known as SDL. The SDL is used to express the types available in the schema and how those relate to each other:
In the above example we can see that we a book type and also an author type. The book contains a title which is a string and an author. The Author type contains a name which is a string and multiple books, which is an array of books.
This is just the tip of the iceberg, read more about graphQL types