@@ -108,7 +108,7 @@ You can nest `app.resolver()` decorator multiple times when resolving fields wit
108
108
109
109
=== "nested_mappings.py"
110
110
111
- ```python hl_lines="2 8 18-19 21 28 "
111
+ ```python hl_lines="4 10 20- 21 23 30 "
112
112
--8<-- "examples/event_handler_graphql/src/nested_mappings.py"
113
113
```
114
114
@@ -122,28 +122,8 @@ You can nest `app.resolver()` decorator multiple times when resolving fields wit
122
122
123
123
For Lambda Python3.8+ runtime, this utility supports async functions when you use in conjunction with ` asyncio.run ` .
124
124
125
- ``` python hl_lines="5 9 11-13 21" title="Resolving GraphQL resolvers async"
126
- import asyncio
127
- from aws_lambda_powertools import Logger, Tracer
128
-
129
- from aws_lambda_powertools.logging import correlation_paths
130
- from aws_lambda_powertools.event_handler import AppSyncResolver
131
-
132
- tracer = Tracer(service = " sample_resolver" )
133
- logger = Logger(service = " sample_resolver" )
134
- app = AppSyncResolver()
135
-
136
- @app.resolver (type_name = " Query" , field_name = " listTodos" )
137
- async def list_todos ():
138
- todos = await some_async_io_call()
139
- return todos
140
-
141
- @logger.inject_lambda_context (correlation_id_path = correlation_paths.APPSYNC_RESOLVER )
142
- @tracer.capture_lambda_handler
143
- def lambda_handler (event , context ):
144
- result = app.resolve(event, context)
145
-
146
- return asyncio.run(result)
125
+ ``` python hl_lines="7 14 24-25 34 36" title="Resolving GraphQL resolvers async"
126
+ -- 8 < -- " examples/event_handler_graphql/src/async_resolvers.py"
147
127
```
148
128
149
129
### Amplify GraphQL Transformer
0 commit comments