webdev_graphql_formatter
Format, minify, and validate GraphQL documents (queries, mutations, schemas) with configurable indentation and bracket-balance checking.
Instructions
GraphQL Formatter and Minifier. Pretty-print or minify a GraphQL document (query, mutation, subscription, fragment, or SDL schema) with configurable indentation, and report bracket-balance validation plus document statistics. Use webdev_sql_formatter for SQL and webdev_json_formatter for JSON. This is a syntactic formatter only: it never sends the document to a GraphQL server or executes any operation. Runs locally on the text you provide: read-only, non-destructive, contacts no external service, and is rate-limited (60 requests/minute for anonymous callers). Returns the formatted document, an isValid flag with any brace/parenthesis/bracket errors and warnings, and statistics.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| graphql | Yes | The GraphQL document to format. Must not be blank. | |
| format | No | When true, reindent the document; when false, return the input unchanged. | |
| compactMode | No | Minify: keep comma-separated items on one line instead of one per line. | |
| indentSize | No | Number of spaces per indent level (used only when indentType is spaces). | |
| indentType | No | Indent with spaces (honouring indentSize) or with a single tab per level. | spaces |
| removeComments | No | Strip GraphQL hash (number-sign) comments before formatting. | |
| sortArguments | No | Accepted for forward compatibility; field arguments are not reordered in the current implementation. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| original | No | The submitted GraphQL document, echoed back. | |
| formatted | No | The reindented (or minified) GraphQL document. | |
| isValid | No | True when braces, parentheses, and brackets are all balanced. | |
| errors | No | Bracket-balance errors found during validation. | |
| warnings | No | Non-fatal notes (for example, no operations or type definitions detected). | |
| stats | No | Size and content metrics for the document. |