-
Notifications
You must be signed in to change notification settings - Fork 942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
entgql: possibility to attach custom directives to mutation create and update inputs #3407
Comments
See the merge request above for the fix i wanted. |
Hey, @lucvankessel 👋 Just to make sure you're not blocked on this, check out my |
hey @a8m,
This input is then generated from the mutations in the schema. (i havent tested it yet but, )I dont think the use of SchemaHooks will work in this case due to mutation fields having the directives field used when generating them. In
So directives are never added to them to be able to be generated (or atleast that seems to be the case from what i read, i do not know the entire flow of generating fields in entgql yet so i can be terribly wrong ofcourse) Hope this answers your question. |
Hey @a8m, |
Made this [MR]{https://github.com/ent/contrib/pull/543} a few days ago with a proposed backwards compatible solution. let me know what you think and if it needs changing etc. |
I want to attach a custom directive to a generated mutation create/update field.
Summary 💡
Through the mutations in a field definition in a schema i want to be able to do something like entgql.UpdateMutation.Directive('directive name', {args}) to be able to attach the given directive to it. (using the same syntax as the current way to add directives to the gql type would be preffered)
Motivation 🔦
Right now i can create a custom directive for checking the minimum length of a string(for example). but this directive is executed whenever i get a object from the database and not when i insert one through a create/update input.
This leads to me being unable to attach directives to places i want them on. manually this would be possible but we generate our create and update inputs through the mutations and want to attach them in the schema/field definitions.
The text was updated successfully, but these errors were encountered: