I decided it was time to really learn GraphQL and I am having trouble grasping a few things. So I am reaching out for some guidance.
I started out by cloning the RW example blog and when I spin up the local GraphQL “sandbox” I see on the right hand side of the screen a “Docs” tab with a list Queries & Mutations.
If I click on one it gives me what I assume are payload options. However, when I enter the query in the sandbox I get the following errors:
{
"errors": [
{
"message": "The \"PostsSet\" definition is not executable.",
"locations": [
{
"line": 1,
"column": 1
}
]
}
]
}
What does it mean that “definition is not executable”?
My second question is that if I navigate to api -> scripts -> seed.js
I can see a whole slew of data that I would like to write queries for. For example (in the example blog)I see postData
with title
, slug
, author
and other fields. I am assuming that postData
could be a Root Query Type that I can then traverse the edges “up” and retrieve for example the title(s)
. So, how do I write a query that grabs that data? I tried the following in the GraphQL sandbox:
type postData {
title: [String]!
}
but got this error:
{
"errors": [
{
"message": "The \"postData\" definition is not executable.",
"locations": [
{
"line": 1,
"column": 1
}
]
}
]
}
Any help getting off in the right direction to sort this out would be immensely appreciated. Thank you.