GraphQL Schema - The Beginner's Guide to GraphQL Editor p.1
GraphQL Editor is a tool for both advanced users and those only starting to work on GraphQL APIs.
On the off chance you don't know anything about GraphQL Editor it's a web tool that lets you see and better understand how the schema and various elements within it work, even if you’re not a programmer.
You can even build a schema by joining the visualized blocks and having GraphQL Editor generate the code for them. That’s just the basics and tool has lots of other useful features a bunch of them added in the recent GraphQL Editor v. 4.5 update.
So let’s try it out and set up a very basic schema that should be easy to grasp even for someone completely new to GraphQL. Let’s start by setting up the contact form input:
- Let's add strings (email and message),
- we want make them required.
Now it's time for the types. First let's add a mutation, for this sample mutation we will:
- add a type & set it as a
- make it required,
- add boolean.
All we need now is a query to fetch the data, for that first lets:
- make a form type with strings for email and message,
- For the query we do the same thing we did before: add type, select
queryand once again make it required.
- Now let's make it fetch from the form we made above so remember to check required and also check array and array required here as well.
And it's done
As you can see as we finished this last step it automatically rounds it out as a schema and we can even find out how it looks in the visualization:
And that’s it, you just created a simple GraphQL schema that can fetch two basic values like emails and messages from a database. Obviously, we haven't even scratched the surface of what GraphQL Editor can do so hopefully you’ll stick around to see what we do next time.