Skip to main content

GraphQL Schema Converter & Codegen

Convert GraphQL SDL and introspection JSON both ways and generate TypeScript types in your browser.

SDL Input

0 of 5,242,880 bytes

Options

Fidelity: One-way

Advanced

One mapping per line, written as Name=Type.

TypeScript Output

Paste a GraphQL schema (SDL) or load an example.

Runs locally in your browser. Schemas and operations are never uploaded or stored.

How to use

  1. 1.Choose the input format, paste your schema or load an example, and pick an output.
  2. 2.Small inputs convert as you type; larger ones convert when you press Convert or Ctrl+Enter.
  3. 3.For operation types, choose SDL + Operations and paste queries and fragments in the second editor.
  4. 4.Swap moves SDL or introspection output back into the input and reverses the direction.
  5. 5.Diagnostics list every problem with its line and column; select one to jump to it.

GraphQL Schema Converter & Codegen

GraphQL schemas travel in two forms: SDL text that people write, and introspection JSON that servers return. This tool validates either form with graphql-js, converts between them, prints the parsed AST, and generates TypeScript. Schema types use Maybe for nullable fields, a Scalars map, interfaces intersected into their implementations and enums as string unions, TypeScript enums or as const objects. Resolver types add Resolver signatures, ResolversTypes maps and one resolvers type per object, interface and union. Operation types follow each selection set exactly, including aliases, fragments, unions and conditional fields. The output is compatible with common GraphQL Code Generator conventions, but it is a focused local generator, not identical to that project.

What the TypeScript output contains

Every output starts with Maybe, InputMaybe and a Scalars map. Built-in scalars map to string, number and boolean; custom scalars map to unknown until you add Scalar mappings such as DateTime=string under Advanced. Mappings are checked against a small TypeScript type grammar and are never evaluated. Field arguments become TypeArgs types, nullable input fields become optional unless Avoid optional fields is on, and descriptions and deprecation reasons become JSDoc comments.

Fidelity and lost details

SDL and introspection JSON convert structurally lossless: types, fields, arguments, defaults, descriptions, deprecations and directive definitions are kept. Comments and directives applied to types, such as federation keys, have no place in introspection or printed SDL; the tool lists them as warnings. AST JSON and all TypeScript outputs are one-way.

Privacy

Conversion runs locally in your browser and makes no network requests. Schemas, operations and output are never uploaded or stored; only your option choices are saved in this browser.

Frequently asked questions
Does the converter send my schema to a server or call my GraphQL endpoint?
No. Parsing, validation, conversion and code generation run in your browser with graphql-js. The tool never fetches an endpoint; paste SDL or an introspection result instead.
Is the TypeScript output the same as GraphQL Code Generator?
It follows the common conventions of the typescript, typescript-resolvers and typescript-operations plugins (Maybe, Scalars, Args types, Resolvers, Query and Variables types), but it is a focused local generator, so details and plugin options can differ.
What is lost when converting SDL to introspection JSON?
Types, fields, arguments, default values, descriptions, deprecations and directive definitions are kept. Comments and directives applied to types or fields, such as federation keys, are not part of introspection; the tool warns about them.
Which introspection JSON shapes are accepted?
An object with __schema, the data envelope a server returns, and a full response with data and errors. Errors next to schema data are ignored with a note.

CodingTool is officially live on