GraphQL works by using a "schema" to describe what data is available for querying.
A schema consists of a list of fields, and the "type" for each field. Each field must have a type. A type can be something like String or Int. (More complex custom types can be created too).
In Gatsby, "schema inference" is an automatic process where Gatsby examines your data, then works out the correct schema based on the data.
Here's some example data.
const myTitles = [
{
"title": "A long long time ago",
"rank": 3
},
{
"title": "Mystery title",
"rank": 1
},
{
"title": "The longest title out of all the titles in this list",
"rank": 3
}
]
Note that every "title" is a string, and every "rank" is a number. Gatsby's schema inference would create a schema like this:
title: String
rank: Int
which would let you write a query that looked like this:
allTitles{
title
rank
}
Once you start adding arguments to your queries, hopefully you can see how useful GraphQL can be:
allTitles(filter: {rank: {eq: 3}}) {
title
rank
}