Skip to content

Graphql To Typescript API

POST https://api.findutils.com/api/tools/graphql-to-typescript/execute

Convert a GraphQL SDL schema into TypeScript type definitions and return the generated code with counts of emitted types, enums, and inputs. Object and interface types become interfaces (or type aliases), enums become TypeScript enums, input types are included by default. Non-null fields (!) are required; nullable fields become optional and accept null. Built-in scalars map to string, number, and boolean.

Request body

application/json
  • schema

    string required

    GraphQL schema in SDL (type, input, enum definitions).

  • use_interfaces

    boolean optional

    Emit "interface X {}" instead of "type X = {}". Default: true. Default true.

  • add_exports

    boolean optional

    Prefix every declaration with "export". Default: true. Default true.

  • use_readonly

    boolean optional

    Mark every field readonly. Default: false. Default false.

  • generate_input_types

    boolean optional

    Also emit GraphQL input types. Default: true. Default true.

Example arguments

Verified
{
  "schema": "type User {\n  id: ID!\n  name: String\n}\n\nenum Role {\n  ADMIN\n  USER\n}"
}