🐛 Fix mutation name collision causing parameter validation errors#57
Merged
Conversation
**Problem**: Mutations with similar names (e.g., `CreateItem` and `CreateItemComponent`) were causing parameter validation confusion. The `createItemComponent` mutation would incorrectly require `item_serial_number` from `CreateItemInput` instead of its own `CreateItemComponentInput` fields. **Root Cause**: Resolver naming used `to_snake_case(class_name)` which could create collisions, causing one mutation to overwrite another's metadata in the registry. **Solution**: - Use PostgreSQL function names for resolver naming to ensure uniqueness - Create fresh annotation dictionaries to prevent shared references - Add comprehensive tests to verify fix and prevent regressions **Impact**: - Mutations with similar names now work independently with correct validation - No breaking changes - existing functionality preserved - Enhanced test coverage for mutation name collision scenarios 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
Summary
Fixes a critical bug where mutations with similar names (e.g.,
CreateItemandCreateItemComponent) were causing parameter validation confusion. ThecreateItemComponentmutation would incorrectly requireitem_serial_numberfromCreateItemInputinstead of its ownCreateItemComponentInputfields.Root Cause
The resolver naming strategy used
to_snake_case(class_name)which could create collisions when similar class names produced similar snake_case names. This caused one mutation to overwrite another's metadata in the GraphQL schema registry, leading to incorrect parameter validation.Solution
create_itemvscreate_item_component)Changes
src/fraiseql/mutations/mutation_decorator.py- Updated resolver naming logictests/integration/graphql/mutations/test_similar_mutation_names_collision_fix.py- Comprehensive test coverageImpact
Test plan
Fixes the bug reported in
/tmp/fraiseql_bug_report.md.🤖 Generated with Claude Code