Skip to content

Commit 5bb34d7

Browse files
Minor fix in @keys
1 parent c61f145 commit 5bb34d7

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

examples/inaccessible.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import graphene
22

3-
from graphene_federation import inaccessible, shareable, extend, requires, external, provides
3+
from graphene_federation import inaccessible, external, provides, key
44

55
from graphene_federation import build_schema
66

77

8+
@key(fields="x")
89
class Position(graphene.ObjectType):
910
x = graphene.Int(required=True)
1011
y = external(graphene.Int(required=True))

graphene_federation/entity.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,9 @@ def key(fields: str) -> Callable:
8787
"""
8888
Take as input a field that should be used as key for that entity.
8989
See specification: https://www.apollographql.com/docs/federation/federation-spec/#key
90-
91-
If the input contains a space it means it's a [compound primary key](https://www.apollographql.com/docs/federation/entities/#defining-a-compound-primary-key)
92-
which is not yet supported.
9390
"""
94-
if " " in fields:
95-
raise NotImplementedError("Compound primary keys are not supported.")
9691

9792
def decorator(Type):
98-
# Check the provided fields actually exist on the Type.
99-
assert (
100-
fields in Type._meta.fields
101-
), f'Field "{fields}" does not exist on type "{Type._meta.name}"'
102-
10393
keys = getattr(Type, "_keys", [])
10494
keys.append(fields)
10595
setattr(Type, "_keys", keys)

0 commit comments

Comments
 (0)