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
+17-17Lines changed: 17 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -120,7 +120,7 @@ class Person(PydanticObjectType):
120
120
model = PersonModel
121
121
# exclude specified fields
122
122
exclude_fields = ("id",)
123
-
123
+
124
124
full_name = graphene.String()
125
125
126
126
defresolve_full_name(self, info, **kwargs):
@@ -137,27 +137,27 @@ class NodeModel(BaseModel):
137
137
id: int
138
138
name: str
139
139
labels: 'LabelsModel'
140
-
140
+
141
141
classLabelsModel(BaseModel):
142
142
node: NodeModel
143
143
labels: typing.List[str]
144
-
144
+
145
145
classNode(PydanticObjectType):
146
146
classMeta:
147
147
model = NodeModel
148
-
148
+
149
149
classLabels(PydanticObjectType):
150
150
classMeta:
151
151
model = LabelsModel
152
-
152
+
153
153
154
154
Node.resolve_placeholders() # make the `labels` field work
155
155
Labels.resolve_placeholders() # make the `node` field work
156
156
```
157
157
158
158
### Full Examples
159
159
160
-
Please see [the examples directory](./examples) for more.
160
+
Please see [the examples directory](./examples) for more.
161
161
162
162
### License
163
163
@@ -175,31 +175,31 @@ Please see the [Contributing Guide](./CONTRIBUTING.md). Note that you must sign
175
175
176
176
#### Mappings
177
177
178
-
Note that even though Pydantic is perfectly happy with fields that hold mappings (e.g. dictionaries), because [GraphQL's type system doesn't have them](https://graphql.org/learn/schema/) those fields can't be exported to Graphene types. For instance, this will fail with an error `Don't know how to handle mappings in Graphene`:
178
+
Note that even though Pydantic is perfectly happy with fields that hold mappings (e.g. dictionaries), because [GraphQL's type system doesn't have them](https://graphql.org/learn/schema/) those fields can't be exported to Graphene types. For instance, this will fail with an error `Don't know how to handle mappings in Graphene`:
179
179
180
180
```python
181
181
import typing
182
182
from graphene_pydantic import PydanticObjectType
183
183
184
184
classPet:
185
-
pass
185
+
pass
186
186
187
187
classPerson:
188
-
name: str
189
-
pets_by_name: typing.Dict[str, Pet]
190
-
191
-
classGraphQLPerson(PydanticObjectType):
192
-
classMeta:
193
-
model = Person
188
+
name: str
189
+
pets_by_name: typing.Dict[str, Pet]
190
+
191
+
classGraphQLPerson(PydanticObjectType):
192
+
classMeta:
193
+
model = Person
194
194
```
195
195
196
196
However, note that if you use `exclude_fields` or `only_fields` to exclude those values, there won't be a problem:
0 commit comments