-
Notifications
You must be signed in to change notification settings - Fork 768
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
Update mutation.py #811
Update mutation.py #811
Conversation
Please add a description, I'll try to help you get the ball rolling: This appears to add the following behavior to the Django forms mutation: pass the form data to the error class. What we need to move forward is a unit test demonstrating the use case. We want to make sure the error class can handle the extra data and we would want verify the resulting graphql payload (I am not sure how that extra form data appears to the graphql client for instance). We also need to state the rationale, which I think is to simplify client-side validation by including the data that failed validation in the response. But it might be good to expand on how exactly this will make your life easier. |
Description added |
I think I understand now. This seems valid to me, going forward I think we should copy the following test to reflect this desired behavior:
It would supply age but not name and verify age is sent back as part of the response. |
Added tests @zbyte64 |
Am I crazy or does this PR completely break I think the issue is
It's late here so forgive me if I'm overlooking something. |
Same here, tried to use |
Damn that might well be true. Apologies but we don't have good test coverage in that part of the library so we might have accidentally broken something. I'll try and find some time to fix it. |
Created a PR to fix it here: #915 |
@jarcoal @svengt I've just released v2.9.1 that should fix the issue: https://github.com/graphql-python/graphene-django/releases/tag/v2.9.1 |
Thanks @jkimbo! It's working for me. |
I do not add data to the error class, but add data to payload.
Without sending form data, this request does not work correctly if there are errors in the form.
Here is the answer:
...and we cannot see form errors from the response of this request...
From the Documentation Explorer we see that the request should look like this:
And this is not at all achievable without overriding the method: