You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-15Lines changed: 19 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,22 +66,26 @@ result = schema.execute(query)
66
66
`graphene_pydantic` supports forward declarations and circular references, but you will need to call the `resolve_placeholders()` method to ensure the types are fully updated before you execute a GraphQL query. For instance:
67
67
68
68
```python
69
-
classFooModel(BaseModel):
70
-
bar: 'BarModel'
71
-
72
-
classBarModel(BaseModel):
73
-
foo: FooModel
74
-
75
-
classFoo(PydanticObjectType):
76
-
classMeta:
77
-
model = FooModel
78
-
79
-
classBar(PydanticObjectType):
80
-
classMeta:
81
-
model = BarModel
69
+
classNodeModel(BaseModel):
70
+
id: int
71
+
name: str
72
+
labels: 'LabelsModel'
73
+
74
+
classLabelsModel(BaseModel):
75
+
node: NodeModel
76
+
labels: typing.List[str]
77
+
78
+
classNode(PydanticObjectType):
79
+
classMeta:
80
+
model = NodeModel
81
+
82
+
classLabels(PydanticObjectType):
83
+
classMeta:
84
+
model = LabelsModel
85
+
82
86
83
-
Foo.resolve_placeholders() #<-- this line ensures it's resolvable in GraphQL
84
-
Bar.resolve_placeholders()
87
+
Node.resolve_placeholders() #make the `labels` field work
88
+
Labels.resolve_placeholders()# make the `node` field work
0 commit comments