Skip to content

Commit da73191

Browse files
walmslesto-mc
andauthored
Apply suggestions from code review
Apply suggestions from code review Co-authored-by: Tom McCarthy <[email protected]>
1 parent 4a1ed23 commit da73191

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Diff for: docs/utilities/idempotency.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ In this example, we have a Lambda handler that creates a payment for a user subs
206206

207207
Imagine the function executes successfully, but the client never receives the response due to a connection issue. It is safe to retry in this instance, as the idempotent decorator will return a previously saved response.
208208

209-
!!! warning "Making JSON APIs Idempotent"
210-
To ensure JSON structured APIs are fully idempotent we must ensure the idempotent key is a valid JSON object.
209+
!!! warning "Idempotency for JSON payloads"
210+
The payload extracted by the `event_key_jmespath` is treated as a string by default, so will be sensitive to differences in whitespace even when the JSON payload itself is identical.
211211

212-
To do this we can [customize the default behaviour](#customizing-the-default-behavior) with *event_key_jmespath* and the [JMESPath built-in function](/utilities/jmespath_functions) *powertools_json()*.
212+
To alter this behaviour, we can use the [JMESPath built-in function](/utilities/jmespath_functions) *powertools_json()* to treat the payload as a JSON object rather than a string.
213213

214214
=== "payment.py"
215215

Diff for: docs/utilities/jmespath_functions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: JMESPath Functions
33
description: Utility
44
---
55

6-
You might have events or responses that contain non-encoded JSON, where you need to decode so that you can access portions of the object or ensure the Powertools utility recieves a JSON object
6+
You might have events or responses that contain non-encoded JSON, where you need to decode so that you can access portions of the object or ensure the Powertools utility receives a JSON object. This is a common use case when using the [validation](/utilities/validation) or [idempotency](/utilities/idempotency) utilities.
77

88
## Built-in JMESPath functions
99
You can use our built-in JMESPath functions within your expressions to do exactly that to decode JSON Strings, base64, and uncompress gzip data.

0 commit comments

Comments
 (0)