TypeScript Validation Schema

Package nameWeekly DownloadsVersionLicenseUpdated
graphql-codegen-typescript-validation-schemaDownloadsVersionLicenseNov 23rd, 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:

codegen.ts
import type { CodegenConfig } from '@graphql-codegen/cli'
 
const config: CodegenConfig = {
  generates: {
    'path/to/graphql.ts': {
      plugins: ['typescript', 'typescript-validation-schema'],
      config: {
        strictScalars: true,
        schema: 'yup'
      }
    }
  }
}
export default config

Usage & Documentation

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

Last updated on October 13, 2022