Skip to content

Commit e59c1e5

Browse files
committed
docs: reorder parser's payload sample position
Signed-off-by: heitorlessa <lessa@amazon.co.uk>
1 parent 1991fbe commit e59c1e5

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

docs/content/utilities/parser.mdx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ class Order(BaseModel):
7777
items: List[OrderItem] # nesting models are supported
7878
optional_field: Optional[str] # this field may or may not be available when parsing
7979

80+
81+
@event_parser(model=Order) # highlight-line
82+
def handler(event: Order, context: LambdaContext):
83+
print(event.id)
84+
print(event.description)
85+
print(event.items)
86+
87+
order_items = [items for item in event.items]
88+
...
89+
8090
payload = {
8191
"id": 10876546789,
8292
"description": "My order",
@@ -89,15 +99,6 @@ payload = {
8999
]
90100
}
91101

92-
@event_parser(model=Order) # highlight-line
93-
def handler(event: Order, context: LambdaContext):
94-
print(event.id)
95-
print(event.description)
96-
print(event.items)
97-
98-
order_items = [items for item in event.items]
99-
...
100-
101102
handler(event=payload, context=LambdaContext())
102103
handler(event=json.dumps(payload), context=LambdaContext()) # also works if event is a JSON string
103104
```

0 commit comments

Comments
 (0)