-
Notifications
You must be signed in to change notification settings - Fork 94
/
codegen.yml
54 lines (52 loc) · 1.63 KB
/
codegen.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
schema: './apps/codegen-e2e/example/*.graphql'
generates:
'./apps/codegen-e2e/src/types.ts':
plugins:
- typescript
# Configuration example for graphql-codegen-zod
'./apps/codegen-e2e/src/graphql-codegen-zod/output.ts':
plugins:
- ./dist/libs/graphql-codegen-zod/src/index.js
config:
allowEnumStringTypes: true
onlyWithValidation: false
lazy: true
zodSchemasMap:
EmailAddress: z.string().email()
IPAddress: z.string()
DateTime: z.string()
JSON: z.object()
Date: z.string()
URL: z.string()
zodTypesMap:
EmailAddress: string
# Configuration example for graphql-zod-validation
'./apps/codegen-e2e/src/graphql-zod-validation/zod-generated.ts':
plugins:
- './dist/libs/graphql-zod-validation/src/index.js'
config:
schema: zod
importFrom: ../types
useObjectTypes: true
scalarSchemas:
EmailAddress: z.string().email()
IPAddress: z.string()
DateTime: z.string()
JSON: z.object()
Date: z.string()
URL: z.string()
directives:
# Write directives like
#
# directive:
# arg1: schemaApi
# arg2: ["schemaApi2", "Hello $1"]
#
# See more examples in `./tests/directive.spec.ts`
# https://github.com/Code-Hex/graphql-codegen-typescript-validation-schema/blob/main/tests/directive.spec.ts
constraint:
minLength: min
# Replace $1 with specified `startsWith` argument value of the constraint directive
startsWith: ['regex', '/^$1/', 'message']
format:
email: email