File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,14 @@ generates:
96
96
config:
97
97
schema: yup
98
98
directives:
99
+ # Write directives like
100
+ #
101
+ # directive:
102
+ # arg1: schemaApi
103
+ # arg2: ["schemaApi2", "Hello $1"]
104
+ #
105
+ # See more examples in ` ./tests/directive.spec.ts`
106
+ # https://github.com/Code-Hex/graphql-codegen-typescript-validation-schema/blob/main/tests/directive.spec.ts
99
107
required :
100
108
msg : required
101
109
constraint :
@@ -108,7 +116,7 @@ generates:
108
116
109
117
` ` ` graphql
110
118
input ExampleInput {
111
- email : String! @required(msg: "Hello, World!") @constraint(minLength: 50)
119
+ email : String! @required(msg: "Hello, World!") @constraint(minLength: 50, format: "email" )
112
120
message : String! @constraint(startsWith: "Hello")
113
121
}
114
122
```
@@ -118,7 +126,7 @@ Then generates yup validation schema like below.
118
126
``` ts
119
127
export function ExampleInputSchema(): yup .SchemaOf <ExampleInput > {
120
128
return yup .object ({
121
- email: yup .string ().defined ().required (" Hello, World!" ).min (50 ),
129
+ email: yup .string ().defined ().required (" Hello, World!" ).min (50 ). email () ,
122
130
message: yup .string ().defined ().matches (/ ^ Hello/ )
123
131
})
124
132
}
You can’t perform that action at this time.
0 commit comments