FormatBentoGraphQL
GraphQL formatter
Tidy queries copied from network logs, or schema files written by hand, with Prettier's GraphQL printer. Need the opposite? Compact a query onto one line.
The formatted code lands in this compartment. Ctrl + Enter formats from the keyboard.
Syntax error
Ready. Paste code, open a file or press Sample.
Runs in your browser · nothing is uploadedFormat or compact
Format parses the document with graphql-js through Prettier and prints every selection set on its own lines, arguments wrapped at the print width. Queries, mutations, subscriptions, fragments, variables with defaults, directives and schema definitions (types, inputs, enums, unions, descriptions) are all supported. A syntax error shows the line and column, such as a missing closing brace.
Compact does the reverse: it removes comments, commas and every space GraphQL ignores, keeping a single space only where two names would run together. Strings and """block strings""" are kept exactly. The result is handy for a GET request's query parameter or a log line, and formats back to the same document.
Questions
Does it check my query against a schema?
No. It checks syntax only, so unknown fields or wrong argument types are not reported.
Are comments kept when formatting?
Yes. Formatting keeps # comments; only Compact removes them.
Is anything sent to a GraphQL server?
No. Nothing is executed or uploaded; the text is formatted in this tab.