File tree 1 file changed +8
-9
lines changed
1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -156,16 +156,15 @@ def __init__(
156
156
self .use_directives = use_directives
157
157
158
158
def apply (self , field : StrawberryField ) -> None :
159
- """Applies all of the permission directives to the schema and sets up silent permissions."""
159
+ """Applies all of the permission directives (deduped) to the schema and sets up silent permissions."""
160
160
if self .use_directives :
161
- # Dedupe multiple directives
162
- # https://github.com/strawberry-graphql/strawberry/issues/3596
163
- permission_directives = {
164
- p .schema_directive for p in self .permissions if p .schema_directive
165
- }
166
- existing_field_directives = set (field .directives )
167
- extend_directives = permission_directives - existing_field_directives
168
- field .directives .extend (extend_directives )
161
+ permission_directives = [perm .schema_directive for perm in self .permissions if perm .schema_directive ]
162
+ # Iteration, because we want to keep order
163
+ for perm_directive in permission_directives :
164
+ # Dedupe multiple directives
165
+ if perm_directive in field .directives :
166
+ continue
167
+ field .directives .append (perm_directive )
169
168
# We can only fail silently if the field is optional or a list
170
169
if self .fail_silently :
171
170
if isinstance (field .type , StrawberryOptional ):
You can’t perform that action at this time.
0 commit comments