🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@zbanx/graphql-gen

Package Overview
Dependencies
Maintainers
4
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@zbanx/graphql-gen

unpublished
latest
npmnpm
Version
0.0.1-alpha.9
Version published
Weekly downloads
0
Maintainers
4
Weekly downloads
 
Created
Source

README

Generate TypeScript types from GraphQL schema.

Note: This tool only convert OBJECT, INPUT_OBJECT and ENUM.

Usage

Install:

pnpm i @zbanx/graphql-gen

Create a config file ./graphql-gen.yaml:

# shared type mapping for all endpoints
typeMapping:
  ID: 'number'
  Int: 'number'
  String: 'string'
  Boolean: 'boolean'
  Cursor: 'string'

# array of endpoints
# endpoint: where to fetch schema
# output: where to save generated file (relative to the config file)
# namesOutput: (optional) where to save the query and mutation names (relative to the config file)
# comment: (optional) comment to be added at the top of the file (string or array of string)
# headers: (optional) the http request headers to set on fetching schema
# headersYaml: (optional) external header config file (will override the headers)
# printHeaders: (optional) print headers in the console
# typeMapping: (optional) extra type mapping (override the shared one)
endpoints:
  - endpoint: https://www.exmaple.com/graphql
    output: ./types/graphql.ts
    comment: 'This file was automatically generated and should not be edited.'
    headers: {}
    headersYaml: ./headers.yaml
    printHeaders: false
    typeMapping:`
      Time: 'string'

Run the command:

npx graphql-gen --config graphql-gen.yaml

FAQs

Package last updated on 14 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts