You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
In graphql-tools, I am able to create and add custom directives to almost every part of my typedefs. However, I am unable to add a custom directive to a mutation input variable. For example, I want to apply a directive to the name input variable in a mutation like this:
This lack of functionality is frustrating because it limits the flexibility and reusability of custom directives within mutation input variables.
Describe the solution you'd like
I would like graphql-tools to support the addition of custom directives to mutation input variables. Specifically, I want to be able to define and use a directive, such as @len(min: 2), directly on input variables within mutations. This feature would allow for consistent and centralized validation logic across different parts of the schema.
Describe alternatives you've considered
I have considered using helper functions within resolvers to perform the necessary validation. However, this approach requires writing and maintaining the validation logic in multiple places, which is inefficient and error-prone. The ability to apply directives directly to input variables within mutations and share them between other types would streamline this process and ensure consistency.
Additional context
The primary motivation for this feature is to enhance code maintainability and reusability. By allowing directives on mutation input variables, developers can define validation logic once and apply it consistently across various typedefs. This capability would significantly improve the developer experience and reduce redundancy in resolver functions.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
In graphql-tools, I am able to create and add custom directives to almost every part of my typedefs. However, I am unable to add a custom directive to a mutation input variable. For example, I want to apply a directive to the
name
input variable in a mutation like this:This lack of functionality is frustrating because it limits the flexibility and reusability of custom directives within mutation input variables.
Describe the solution you'd like
I would like graphql-tools to support the addition of custom directives to mutation input variables. Specifically, I want to be able to define and use a directive, such as
@len(min: 2)
, directly on input variables within mutations. This feature would allow for consistent and centralized validation logic across different parts of the schema.Describe alternatives you've considered
I have considered using helper functions within resolvers to perform the necessary validation. However, this approach requires writing and maintaining the validation logic in multiple places, which is inefficient and error-prone. The ability to apply directives directly to input variables within mutations and share them between other types would streamline this process and ensure consistency.
Additional context
The primary motivation for this feature is to enhance code maintainability and reusability. By allowing directives on mutation input variables, developers can define validation logic once and apply it consistently across various typedefs. This capability would significantly improve the developer experience and reduce redundancy in resolver functions.
The text was updated successfully, but these errors were encountered: