Plugins
TypeScript
validation-schema

Plugin Details

Package namegraphql-codegen-typescript-validation-schema
Weekly Downloadsdownloads
Versionlicense
Licenselicense
UpdatedJul 30th, 2022

Installation

yarn add -D graphql-codegen-typescript-validation-schema

Built and maintained by Code-Hex

A plugin for GraphQL Codegen to generate form validation schema (such as yup, zod) based on your GraphQL schema for use in a client application.

Examples

Set up your project per the GraphQL Codegen Docs, and specify this plugin in your codegen.yml:

generates:
  path/to/graphql.ts:
    plugins:
      - typescript
      - typescript-validation-schema # Specify to use this plugin
    config:
      # You can put the config for typescript plugin here
      # See: https://graphql-code-generator.com/plugins/typescript
      strictScalars: true
      # You can also write the config for this plugin together
      schema: yup # or zod

Usage & Documentation

For the complete documentation, please refer to Code-Hex/graphql-codegen-typescript-validation-schema repository.

Last updated on August 10, 2022