Improve error message for generic actions used in - #400
Open
dallingson wants to merge 2 commits into
Open
Conversation
GraphQL mutation blocks by: - Add validation in mutation_types/4 to prevent generic :action being used in create/update/destroy blocks - Raise clear, actionable error with resource, mutation, and action context - Safely handle optional error_location to avoid KeyError - Add tests and test resources covering invalid and valid generic action usage
Contributor
|
Looks like some conflicts. I also know there is a failing build step, I'll address that separately. Please just confirm your tests pass locally and we can merge once the other checks pass 😄 |
Author
|
@zachdaniel Yes, my tests do pass locally! :) If you notice anything else, just let me know. |
Contributor
|
@dallingson can you resolve the merge conflicts? |
olivermt
approved these changes
May 1, 2026
Contributor
There was a problem hiding this comment.
Tested locally, works as advertised and code looks good to me cc: @zachdaniel
Edit: lol you are already looking at it, didnt see that before I commented. Didnt look at the merge conflicts
Contributor
|
Yeah just needs to have conflicts resolved. Someone could create a new PR and fix those too 😄 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improve error message for generic actions used in GraphQL mutation blocks
Problem
When developers accidentally use a generic action (type
:action) in a typed GraphQL mutation block (create,update, ordestroy), they get a crypticKeyErrorinstead of a helpful error message.Before:
Solution
Added early validation that catches the mistake and provides a clear error message with fix suggestions.
After:
Changes
mutation_types/4to catch generic actions in typed mutation blocks earlyMap.get/3for defensive codingContributor checklist