首页Home › 开发工具Developer Tools

🔷 GraphQL 格式化GraphQL Formatter

美化 GraphQL 查询、变更和 Schema(SDL):统一缩进与换行,语法错误提示行列号,基于 Prettier,在浏览器本地运行。Beautify GraphQL queries, mutations and schemas (SDL) with consistent indentation and line breaks, plus line/column syntax errors — powered by Prettier, running locally.

使用说明与常见问题How-to & FAQ

「GraphQL 格式化」是什么?What is the GraphQL Formatter tool?

美化 GraphQL 查询、变更和 Schema(SDL):统一缩进与换行,语法错误提示行列号,基于 Prettier,在浏览器本地运行。Beautify GraphQL queries, mutations and schemas (SDL) with consistent indentation and line breaks, plus line/column syntax errors — powered by Prettier, running locally.

如何使用「GraphQL 格式化」?How do I use the GraphQL Formatter tool?

在「GraphQL 格式化」中,把内容粘贴或输入到上方输入框,按需设置「缩进」、「行宽」,结果会实时显示在下方,点击「复制结果」即可复制。例如输入「query{user(id:1){name,friends{name}}}」,得到「query { ⏎ user(id: 1) { ⏎ name ⏎ friends { ⏎ name ⏎ } ⏎ } ⏎ }」。In the GraphQL Formatter: Paste or type into the input box, adjust "Indent", "Print width"; the result appears below instantly — click "Copy result" to copy it. Example: "query{user(id:1){name,friends{name}}}" → "query { ⏎ user(id: 1) { ⏎ name ⏎ friends { ⏎ name ⏎ } ⏎ } ⏎ }".

支持哪些 GraphQL 内容?What GraphQL can it format?

查询、变更、订阅、片段、变量定义、指令以及 Schema 定义语言(type、interface、enum、input、union、schema 扩展等)。Queries, mutations, subscriptions, fragments, variables, directives and the schema definition language (type, interface, enum, input, union, extensions…).

用的是什么工具?What powers it?

Prettier(MIT 许可)的独立浏览器版,首次格式化时才加载约 130 KB 的组件;代码不会上传。The standalone browser build of Prettier (MIT); about 130 KB is loaded the first time you format, and your code is never uploaded.

代码或数据会被上传吗?Is my code or data uploaded?

不会。「GraphQL 格式化」完全用 JavaScript 在本地运行,适合处理含有密钥、内部接口等敏感内容的数据。No. The GraphQL Formatter runs entirely in local JavaScript, so it is safe for data containing keys or internal endpoints.

「GraphQL 格式化」免费吗?需要注册吗?Is the GraphQL Formatter free? Do I need an account?

「GraphQL 格式化」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The GraphQL Formatter is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.

相关工具Related tools

🟦 TypeScript 格式化TypeScript Formatter🗺️ XML 网站地图生成器XML Sitemap Generator⚙️ 位运算计算器Bitwise Calculator🛡️ 隐私政策生成器Privacy Policy Generator🧾 JSON 格式化校验JSON Formatter & Validator🧪 正则表达式测试Regex Tester⏰ Cron 表达式解析Cron Expression Explainer🔀 YAML JSON 互转YAML to JSON Converter📊 CSV JSON 互转CSV to JSON ConverterⓂ️ Markdown 在线预览Markdown Live Preview🗄️ SQL 格式化/压缩SQL Formatter & Minifier🧵 字符串转义/反转义String Escape / Unescape

← 全部工具All tools