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:
9696 config:
9797 schema: yup
9898 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
99107 required :
100108 msg : required
101109 constraint :
@@ -108,7 +116,7 @@ generates:
108116
109117` ` ` graphql
110118input ExampleInput {
111- email : String! @required(msg: "Hello, World!") @constraint(minLength: 50)
119+ email : String! @required(msg: "Hello, World!") @constraint(minLength: 50, format: "email" )
112120 message : String! @constraint(startsWith: "Hello")
113121}
114122```
@@ -118,7 +126,7 @@ Then generates yup validation schema like below.
118126``` ts
119127export function ExampleInputSchema(): yup .SchemaOf <ExampleInput > {
120128 return yup .object ({
121- email: yup .string ().defined ().required (" Hello, World!" ).min (50 ),
129+ email: yup .string ().defined ().required (" Hello, World!" ).min (50 ). email () ,
122130 message: yup .string ().defined ().matches (/ ^ Hello/ )
123131 })
124132}
You can’t perform that action at this time.
0 commit comments