diff --git a/README.md b/README.md index 307a6c82..9f0a56be 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,8 @@ generates: You can check [example directory](https://github.com/Code-Hex/graphql-codegen-typescript-validation-schema/tree/main/example) if you want to see more complex config example or how is generated some files. +...And I wrote some tips in there. + ## Config API Reference ### `schema` @@ -96,7 +98,7 @@ input ExampleInput { } ``` -#### yup +#### yup schema ```yml generates: @@ -136,8 +138,7 @@ export function ExampleInputSchema(): yup.SchemaOf { } ``` -#### zod - +#### zod schema ```yml generates: diff --git a/example/yup/README.md b/example/yup/README.md new file mode 100644 index 00000000..bfee2a63 --- /dev/null +++ b/example/yup/README.md @@ -0,0 +1,11 @@ +# Tips for yup schema + +## How to overwrite generated schema? + +You can use yup [shape API](https://github.com/jquense/yup#objectshapefields-object-nosortedges-arraystring-string-schema). + +```ts +const AttributeInputSchemaWithUUID = AttributeInputSchema().shape({ + key: z.string().uuid(), +}); +``` \ No newline at end of file diff --git a/example/zod/README.md b/example/zod/README.md new file mode 100644 index 00000000..1c3d1842 --- /dev/null +++ b/example/zod/README.md @@ -0,0 +1,11 @@ +# Tips for zod schema + +## How to overwrite generated schema? + +You can use zod [extend API](https://github.com/colinhacks/zod#extend). + +```ts +const AttributeInputSchemaWithCUID = AttributeInputSchema().extend({ + key: z.string().cuid(), +}); +``` \ No newline at end of file