Skip to content

Commit dab27e1

Browse files
authored
Merge pull request #7 from Code-Hex/add/tips
added some tips
2 parents cbba133 + b14d8d5 commit dab27e1

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ generates:
3131
3232
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.
3333
34+
...And I wrote some tips in there.
35+
3436
## Config API Reference
3537
3638
### `schema`
@@ -96,7 +98,7 @@ input ExampleInput {
9698
}
9799
```
98100

99-
#### yup
101+
#### yup schema
100102

101103
```yml
102104
generates:
@@ -136,8 +138,7 @@ export function ExampleInputSchema(): yup.SchemaOf<ExampleInput> {
136138
}
137139
```
138140

139-
#### zod
140-
141+
#### zod schema
141142

142143
```yml
143144
generates:

example/yup/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Tips for yup schema
2+
3+
## How to overwrite generated schema?
4+
5+
You can use yup [shape API](https://github.com/jquense/yup#objectshapefields-object-nosortedges-arraystring-string-schema).
6+
7+
```ts
8+
const AttributeInputSchemaWithUUID = AttributeInputSchema().shape({
9+
key: z.string().uuid(),
10+
});
11+
```

example/zod/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Tips for zod schema
2+
3+
## How to overwrite generated schema?
4+
5+
You can use zod [extend API](https://github.com/colinhacks/zod#extend).
6+
7+
```ts
8+
const AttributeInputSchemaWithCUID = AttributeInputSchema().extend({
9+
key: z.string().cuid(),
10+
});
11+
```

0 commit comments

Comments
 (0)