-
Notifications
You must be signed in to change notification settings - Fork 1
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
Added duplicate check for ObjectTypeExtensionNode #316
Conversation
Reviewer's Guide by SourceryThis pull request adds functionality to check for duplicate fields in ObjectTypeExtensionNode, enhancing the existing duplicate check system for GraphQL schema definitions. The changes primarily involve adding new functions to handle extension types and modifying existing functions to accommodate these changes. Class diagram for updated duplicate check systemclassDiagram
class AllowedOutputTypeDefinitionNode {
<<type>>
}
class AllowedInputTypeDefinitionNode {
<<type>>
}
class AllowedExtensionTypeDefinitionNode {
<<type>>
}
class processExtensionTypeNode {
+processExtensionTypeNode(outputTypeNode: AllowedExtensionTypeDefinitionNode, processedNodes: string[], errors: string[])
}
class recursiveFunctionToFindExtensionFieldDefinitions {
+recursiveFunctionToFindExtensionFieldDefinitions(node: AllowedExtensionTypeDefinitionNode | FieldDefinitionNode, fieldDefinitions: FieldDefinitionNode[]): FieldDefinitionNode[]
}
class processOutputTypeNode {
+processOutputTypeNode(outputTypeNode: AllowedOutputTypeDefinitionNode, processedNodes: string[], errors: string[])
}
class checkForDuplicateFieldsInOutputTypeNode {
+checkForDuplicateFieldsInOutputTypeNode(outputTypeNode: AllowedOutputTypeDefinitionNode, errors: string[])
}
class recursiveFunctionToFindOutputFieldDefinitions {
+recursiveFunctionToFindOutputFieldDefinitions(node: AllowedOutputTypeDefinitionNode | FieldDefinitionNode, fieldDefinitions: FieldDefinitionNode[]): FieldDefinitionNode[]
}
class processInputTypeNode {
+processInputTypeNode(inputTypeNode: AllowedInputTypeDefinitionNode, processedNodes: string[], errors: string[])
}
class checkForDuplicateFieldsInInputTypeNode {
+checkForDuplicateFieldsInInputTypeNode(inputTypeNode: AllowedInputTypeDefinitionNode, errors: string[])
}
class recursiveFunctionToFindInputValueDefinitions {
+recursiveFunctionToFindInputValueDefinitions(node: AllowedInputTypeDefinitionNode | InputValueDefinitionNode, inputValueDefinitions: InputValueDefinitionNode[]): InputValueDefinitionNode[]
}
AllowedExtensionTypeDefinitionNode --> processExtensionTypeNode
processExtensionTypeNode --> recursiveFunctionToFindExtensionFieldDefinitions
AllowedOutputTypeDefinitionNode --> processOutputTypeNode
processOutputTypeNode --> checkForDuplicateFieldsInOutputTypeNode
checkForDuplicateFieldsInOutputTypeNode --> recursiveFunctionToFindOutputFieldDefinitions
AllowedInputTypeDefinitionNode --> processInputTypeNode
processInputTypeNode --> checkForDuplicateFieldsInInputTypeNode
checkForDuplicateFieldsInInputTypeNode --> recursiveFunctionToFindInputValueDefinitions
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @mgupta83 - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider refactoring the process*TypeNode functions to reduce code duplication. There's significant overlap in functionality between processExtensionTypeNode, processOutputTypeNode, and processInputTypeNode.
- The recursive functions for finding field definitions (recursiveFunctionToFind*FieldDefinitions) could potentially be generalized into a single function that works across different node types, improving code maintainability.
- Consider standardizing the use of processedNodesMap. Currently, it's treated inconsistently as both a Map of arrays and a Map of Sets. Choosing one approach and sticking to it would improve code consistency.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Review instructions: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This pull request fixes a duplicate check issue for the
ObjectTypeExtensionNode
. Previously, the code was not properly checking for duplicates when processing extension types. This PR adds a new functionprocessExtensionTypeNode
to handle extension types and ensures that duplicate fields are properly detected.Summary by Sourcery
Fix the issue of not detecting duplicate fields in ObjectTypeExtensionNode by introducing a new function to process extension types and updating the logic to check for duplicates.
Bug Fixes: