Skip to content

Commit 029c4e0

Browse files
committed
fixed README
1 parent d3d13e3 commit 029c4e0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff 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
110118
input 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
119127
export 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
}

0 commit comments

Comments
 (0)