-
-
Notifications
You must be signed in to change notification settings - Fork 53
[Feature Request] Allow functions in directive parameters #422
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
@elijaholmos Thanks for your suggestion! |
graphql-codegen encourages the use of a typescript-based configuration by default, which naturally offers substantially more features than its yaml counterpart. We could perhaps simply not support this feature if a yaml configuration is present, as that would indeed be cumbersome to work with. |
@elijaholmos Could you give me PR for this implementation? Thanks! |
* Add support for directives without arguments like `@required()` * Add support for custom directive mapping Closes Code-Hex#422, Code-Hex#781
* Add support for directives without arguments like `@required()` * Add support for custom directive mapping Closes Code-Hex#422, Code-Hex#781
I have a use case where I would like to be able to pass more than just a string as a directive argument. For example, if I have a directive designed to enforce uniqueness on arrays (in Zod), I would want to use the
refine()
method like so:Translating this to typescript-validation-schema:
With my
CodegenConfig
defined in a TypeScript file: (https://the-guild.dev/graphql/codegen/docs/config-reference/codegen-config)However, that directive configuration yields the following error:

My request is that the typescript-validation-schema package can support receiving functions as arguments for custom directive definitions.
The text was updated successfully, but these errors were encountered: