From 6ca5c13cdd5a0e792418ded7b87b378d8b4e0be9 Mon Sep 17 00:00:00 2001 From: Kei Kamikawa Date: Mon, 31 Jan 2022 11:05:41 +0900 Subject: [PATCH 1/2] fix(website): added typescript-validation-schema plugin --- ...ql-codegen-typescript-validation-schema.md | 29 +++++++++++++++++++ website/src/lib/plugins.ts | 7 +++++ 2 files changed, 36 insertions(+) create mode 100644 website/docs-templates/graphql-codegen-typescript-validation-schema.md diff --git a/website/docs-templates/graphql-codegen-typescript-validation-schema.md b/website/docs-templates/graphql-codegen-typescript-validation-schema.md new file mode 100644 index 00000000000..008201dc8d4 --- /dev/null +++ b/website/docs-templates/graphql-codegen-typescript-validation-schema.md @@ -0,0 +1,29 @@ +--- +id: typescript-validation-schema +--- + +_Built and maintained by [Code-Hex](https://github.com/Code-Hex)_ + +A plugin for GraphQL Codegen to generate form validation schema (such as [yup](https://github.com/jquense/yup), [zod](https://github.com/colinhacks/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: + +```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://www.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](https://github.com/Code-Hex/graphql-codegen-typescript-validation-schema) repository. diff --git a/website/src/lib/plugins.ts b/website/src/lib/plugins.ts index 0b117c87e10..efa9d2de568 100644 --- a/website/src/lib/plugins.ts +++ b/website/src/lib/plugins.ts @@ -375,6 +375,13 @@ const PACKAGES: Package[] = [ iconUrl: '/assets/img/icons/graphql.svg', tags: ['plugin', 'urql', 'typescript'], }, + { + identifier: 'typescript-validation-schema', + title: 'TypeScript Validation Schema', + npmPackage: 'graphql-codegen-typescript-validation-schema', + iconUrl: '/assets/img/icons/graphql.svg', + tags: ['plugin', 'validation', 'yup', 'zod', 'typescript'], + }, ]; export const packageList = PACKAGES.map(p => ({ From a6267fab9f7eefeefb2d0b391ea68b20d8bf1c67 Mon Sep 17 00:00:00 2001 From: Kei Kamikawa Date: Mon, 31 Jan 2022 19:55:29 +0900 Subject: [PATCH 2/2] renamed to typescript-validation-schema.md --- ...cript-validation-schema.md => typescript-validation-schema.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename website/docs-templates/{graphql-codegen-typescript-validation-schema.md => typescript-validation-schema.md} (100%) diff --git a/website/docs-templates/graphql-codegen-typescript-validation-schema.md b/website/docs-templates/typescript-validation-schema.md similarity index 100% rename from website/docs-templates/graphql-codegen-typescript-validation-schema.md rename to website/docs-templates/typescript-validation-schema.md