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: docs/core/event_handler/appsync.md
+9-6
Original file line number
Diff line number
Diff line change
@@ -170,7 +170,6 @@ This is the sample infrastructure we are using for the initial examples with a A
170
170
Value: !GetAtt HelloWorldApi.Arn
171
171
```
172
172
173
-
174
173
### Resolver decorator
175
174
176
175
You can define your functions to match GraphQL types and fields with the `app.resolver()` decorator.
@@ -238,6 +237,7 @@ Here's an example where we have two separate functions to resolve `getTodo` and
238
237
```
239
238
240
239
=== "getTodo_event.json"
240
+
241
241
```json
242
242
{
243
243
"arguments": {
@@ -288,6 +288,7 @@ Here's an example where we have two separate functions to resolve `getTodo` and
288
288
```
289
289
290
290
=== "listTodos_event.json"
291
+
291
292
```json
292
293
{
293
294
"arguments": {},
@@ -395,6 +396,7 @@ You can nest `app.resolver()` decorator multiple times when resolving fields wit
395
396
For Lambda Python3.8+ runtime, this utility supports async functions when you use in conjunction with `asyncio.run`.
396
397
397
398
=== "async_resolver.py"
399
+
398
400
```python hl_lines="4 8 10-12 20"
399
401
from aws_lambda_powertools import Logger, Tracer
400
402
@@ -602,7 +604,6 @@ Use the following code for `merchantInfo` and `searchMerchant` functions respect
602
604
603
605
You can subclass `AppSyncResolverEvent` to bring your own set of methods to handle incoming events, by using `data_model` param in the `resolve` method.
604
606
605
-
606
607
=== "custom_model.py"
607
608
608
609
```python hl_lines="11-14 19 26"
@@ -662,8 +663,8 @@ You can subclass `AppSyncResolverEvent` to bring your own set of methods to hand
662
663
663
664
=== "listLocations_event.json"
664
665
665
-
```json
666
-
{
666
+
```json
667
+
{
667
668
"arguments": {},
668
669
"identity": null,
669
670
"source": null,
@@ -707,8 +708,8 @@ You can subclass `AppSyncResolverEvent` to bring your own set of methods to hand
707
708
"variables": {}
708
709
},
709
710
"stash": {}
710
-
}
711
-
```
711
+
}
712
+
```
712
713
713
714
## Testing your code
714
715
@@ -719,6 +720,7 @@ You can use either `app.resolve(event, context)` or simply `app(event, context)`
719
720
Here's an example from our internal functional test.
720
721
721
722
=== "test_direct_resolver.py"
723
+
722
724
```python
723
725
def test_direct_resolver():
724
726
# Check whether we can handle an example appsync direct resolver
@@ -739,6 +741,7 @@ Here's an example from our internal functional test.
0 commit comments