Skip to content

Commit

Permalink
https://github.com/strawberry-graphql/strawberry/issues/3596
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Bayr committed Oct 17, 2024
1 parent 56172dc commit 80df22e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions strawberry/permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,12 @@ def __init__(
def apply(self, field: StrawberryField) -> None:
"""Applies all of the permission directives to the schema and sets up silent permissions."""
if self.use_directives:
field.directives.extend(
p.schema_directive for p in self.permissions if p.schema_directive
)
# Dedupe multiple directives
# https://github.com/strawberry-graphql/strawberry/issues/3596
permission_directives = {p.schema_directive for p in self.permissions if p.schema_directive}
existing_field_directives = set(field.directives)
extend_directives = permission_directives - existing_field_directives
field.directives.extend(extend_directives)
# We can only fail silently if the field is optional or a list
if self.fail_silently:
if isinstance(field.type, StrawberryOptional):
Expand Down

0 comments on commit 80df22e

Please sign in to comment.