Closed
Description
I want to handle Enum value on directive arguments.
For example, @validateString(format: EMAIL)
use enum value on arguemnts.
directive @validateString(
format: StringFormat
) on INPUT_FIELD_DEFINITION | ARGUMENT_DEFINITION
enum StringFormat {
EMAIL
IP
}
# All validation directives
input Example {
email: String! @validateString(format: EMAIL)
ip: String! @validateString(format: IP)
}
graphql-codegen-typescript-validation-schema always ignore the enum value, I think.
How to handle enum on directive arguments?
Example
I try to write following config, but it is just ignored.
"src/graphql.ts": {
plugins: [
"typescript",
"typescript-validation-schema"
],
config: {
schema: "zod",
strictScalars: true,
scalars: {
ID: "string"
},
scalarSchemas: {
},
enumsAsTypes: true,
directives: {
validateString: {
format: {
EMAIL: "email",
IP: "ip"
}
}
},
},
}
It is ideal to be able to convert to the next by setting something.
@validateString(format: EMAIL)
→
z.string().email()
Metadata
Metadata
Assignees
Labels
No labels