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
**PS.: Take care with receiving args like `my_arg` as above. This doesn't work for optional (non-required) arguments as stantard `Connection`'s arguments (first, before, after, before).**
126
+
You may need something like this:
127
+
128
+
```python
129
+
defresolve_my_field(self, info, known_field1, known_field2, **args): ## get other args with: args.get('arg_key')
130
+
```
131
+
125
132
And, if you need the context in the resolver, you can use `info.context`:
126
133
127
134
```python
@@ -193,14 +200,78 @@ class MyObject(ObjectType):
193
200
194
201
## Mutation.mutate
195
202
196
-
Now only receives (`root`, `info`, `**args`)
203
+
Now only receives (`self`, `info`, `**args`) and is not a @classmethod
204
+
205
+
Before:
206
+
207
+
```python
208
+
classSomeMutation(Mutation):
209
+
...
210
+
211
+
@classmethod
212
+
defmutate(cls, instance, args, context, info):
213
+
...
214
+
```
215
+
216
+
With 2.0:
217
+
218
+
```python
219
+
classSomeMutation(Mutation):
220
+
...
221
+
222
+
defmutate(self, info, **args):
223
+
...
224
+
```
225
+
226
+
With 2.0 you can also get your declared (as above) `args` this way:
227
+
228
+
```python
229
+
classSomeMutation(Mutation):
230
+
classArguments:
231
+
first_name = String(required=True)
232
+
last_name = String(required=True)
233
+
...
234
+
235
+
defmutate(self, info, first_name, last_name):
236
+
...
237
+
```
238
+
197
239
198
240
199
241
## ClientIDMutation.mutate_and_get_payload
200
242
201
243
Now only receives (`root`, `info`, `**input`)
202
244
203
245
246
+
### Middlewares
247
+
248
+
If you are using Middelwares, you need to some adjustments:
0 commit comments