GraphQL Validator

About the tool

Use this tool to validate GraphQL queries against a GraphQL schema.

Demo

The GraphQL query validates successfully against the provided schema.

What is GraphQL?

GraphQL is a popular, modern approach for building APIs. GraphQL APIs come with a schema that describes the data model and allows clients to query and mutate the data.

What is a GraphQL schema?

A GraphQL schema defines the data fields/elements that are available in the API, essentially defining the underlying data model/contract between the client and the server.

The schema is written in the GraphQL Schema Definition Language (SDL) and primarily defines the object types, fields, and their relationships. (I find GraphQL SDL to be very elegant and expressive for capturing logical data models.)

The defined data model represents the data as a graph of JSON-like objects that are interconnected and can be queried/mutated using GraphQL queries.

What are GraphQL queries?

GraphQL queries are JSON-like documents that describe the data that the client wants to retrieve or modify. GraphQL servers can only process queries that are well-formed and conform to the defined data model.

Motivation

Writing GraphQL queries requires adherence to the defined schema. Both the queries and schema can become quite complex which can lead to queries failing unexpectedly when they don't conform to the schema.

I hope that you find this tool useful for validating or troubleshooting your queries.

How does it work?

I built this tool on top of the GraphQL.js library. I use the library to build the schema from SDL, parse the query from source, and validate the query against the schema. All this runs purely on the client.

See also

Query FHIR stores using GraphQL.
FHIR, GraphQL
Check the validity of GraphQL schemas.
GraphQL

Made by Anton Vasetenkov.

If you want to say hi, you can reach me on LinkedIn or via email. If you like my work, you can support me by buying me a coffee.