We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the Bug When custom directives are added, extensions are appended twice in the get_extensions function in the schema.py file.
Issue In the following code: https://github.com/strawberry-graphql/strawberry/blob/main/strawberry/schema/schema.py line 299
def get_extensions(self, sync: bool = False) -> list[SchemaExtension]: extensions = [] if self.directives: extensions = [ *self.extensions, DirectivesExtensionSync if sync else DirectivesExtension, ] extensions.extend(self.extensions) return [ ext if isinstance(ext, SchemaExtension) else ext(execution_context=None) for ext in extensions ]
The extensions list already contains self.extensions, and then extend(self.extensions) adds them again, causing duplicates.
Example Reproduction
>>> ex = ["a", "b"] >>> extensions = [*ex] >>> extensions ['a', 'b'] >>> extensions.extend(ex) >>> extensions ['a', 'b', 'a', 'b']
Expected Behavior Extensions should not be duplicated when custom directives are present.
Suggested Fix Modify the logic to avoid adding self.extensions twice. remove line extensions.extend(self.extensions)
extensions.extend(self.extensions)
The text was updated successfully, but these errors were encountered:
Hey @doney-dkp ,
nice catch there!
Do you want to try to submit a PR to fix that?
Sorry, something went wrong.
@bellini666 sure, happy to do
No branches or pull requests
Describe the Bug
When custom directives are added, extensions are appended twice in the get_extensions function in the schema.py file.
Issue
In the following code:
https://github.com/strawberry-graphql/strawberry/blob/main/strawberry/schema/schema.py
line 299
The extensions list already contains self.extensions, and then extend(self.extensions) adds them again, causing duplicates.
Example Reproduction
Expected Behavior
Extensions should not be duplicated when custom directives are present.
Suggested Fix
Modify the logic to avoid adding self.extensions twice.
remove line
extensions.extend(self.extensions)
The text was updated successfully, but these errors were encountered: