Skip to content
HALOWERK

Codewerk

graphql to ts

Parses and validates the SDL with graphql-js 17.0.2 (a missing Query root is tolerated for type-only fragments) and walks the schema itself: object and interface types become interfaces with an optional __typename literal, nullable fields become "T | null", lists become Array<.>, input objects get optional keys for nullable fields, enums become string-literal unions (or TS enums), unions become union types, custom scalars become aliases (default unknown, mappable to string/number/boolean)..

POST https://code.halowerk.com/v1/graphql-to-ts

Inputs

Fields of the published input schema
FieldTypeRequiredDescription
sdlstringYesGraphQL schema definition language (SDL).
enumsstringNoRender enums as string-literal unions or as TypeScript enums.
scalarsobjectNoTypeScript type per custom scalar name, e.g. {"DateTime": "string"}.
Show full input schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "sdl"
  ],
  "properties": {
    "sdl": {
      "type": "string",
      "minLength": 3,
      "maxLength": 1000000,
      "description": "GraphQL schema definition language (SDL)."
    },
    "enums": {
      "type": "string",
      "enum": [
        "union",
        "enum"
      ],
      "default": "union",
      "description": "Render enums as string-literal unions or as TypeScript enums."
    },
    "scalars": {
      "type": "object",
      "maxProperties": 100,
      "additionalProperties": {
        "type": "string",
        "enum": [
          "string",
          "number",
          "boolean",
          "unknown",
          "Record<string, unknown>",
          "Array<unknown>"
        ]
      },
      "description": "TypeScript type per custom scalar name, e.g. {\"DateTime\": \"string\"}."
    }
  }
}

Open original schema

Published input example

{
  "sdl": "type Query { user(id: ID!): User }\n\"\"\"A registered user\"\"\"\ntype User { id: ID! name: String friends: [User!]! role: Role! }\nenum Role { ADMIN MEMBER }",
  "scalars": {}
}

Result & documentation

Machine-readable documentation of this hub

Source of this page: the published HALOWERK catalog. Updated: 2026-11-17 UTC.

More endpoints in this hub

All endpoints in this hub โ†’