Toolvist

Formateador GraphQL

Formatea y embellece consultas, mutaciones, fragmentos y esquemas GraphQL con indentación uniforme. Formateador GraphQL que corre en tu navegador.

Formateador GraphQL gratuito

Embellece consultas, mutaciones y esquemas GraphQL en código limpio y legible. Este formateador re-indenta los conjuntos de selección anidados, normaliza el espaciado y mantiene argumentos y directivas ordenados para que las consultas largas sean fáciles de escanear.

Schema work continues with the JSON Schema Generator, and the payloads it returns are read with the JSON Formatter & Beautifier. For the REST equivalent of the same request, the Curl Command Builder is the tool.

Cómo usar Formateador GraphQL

  1. 1 Paste your query, mutation or schema.
  2. 2 Format. Fields are indented by nesting depth and arguments are grouped.
  3. 3 Check the reported error for an unbalanced brace, which is the usual cause of a failure.
  4. 4 Copy the formatted result.

Cómo usarlo

Pega una consulta o esquema GraphQL y haz clic en Formatear. Elige un tamaño de sangría y si colapsar listas de argumentos cortas. El resultado formateado se puede copiar directamente a tu editor o a una herramienta de API.

  • Re-indenta conjuntos de selección y llaves anidados
  • Normaliza espacios en blanco y comas
  • Ordena alfabéticamente cada conjunto de selección (opcional)
  • Sangría ajustable (2 espacios, 4 espacios o tab)

¿Qué es GraphQL?

GraphQL es un lenguaje de consultas para APIs que permite a un cliente solicitar exactamente los campos que necesita. Una consulta se escribe como un conjunto de conjuntos de selección anidados rodeados de llaves; este formateador recorre esa estructura y la emite de nuevo con sangría consistente, lo que hace mucho más fácil revisar consultas complejas con anidamiento profundo.

Preguntas frecuentes

Why does GraphQL need its own formatter?

Because it has its own syntax. It is not JSON and not JavaScript, so neither formatter understands it. GraphQL has queries, mutations, fragments, variables with type annotations, directives, and schema definition language, all with their own indentation conventions that a generic tool will mangle.

What is the difference between a query and a mutation?

Semantically, a query reads and a mutation writes. Syntactically they are nearly identical. The distinction matters to the server's execution model: fields within a query may be resolved in parallel, whereas top-level mutation fields are guaranteed to execute in the order written, which is why mutations that depend on each other must be sequenced.

How should I format a query with variables?

Keep the operation signature on its own line with the variable definitions, then a blank line, then the selection set. Variables are declared with their types and can be marked required. Keeping the declaration separate from the body makes it obvious what the caller must supply.

Herramientas para desarrolladores relacionadas

Ver todo en Herramientas para desarrolladores →

También te puede interesar

Herramientas de otras categorías que suelen combinarse con Formateador GraphQL:

Explorar el directorio completo →