Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

1.10.0 #588

Unanswered
hjgraca asked this question in General
May 9, 2024 · 0 comments
Discussion options

Summary

In this release we introduce built in JMESPath support for Powertools Idempotency utility.
With this release we remove the need for 3rd party dependencies and move from the old Newtonsoft.Json to the new System.Text.Json also is fully JMESPath spec compliant.

Fully backwards compatible, there are no changes to the way you having been using Idempotency before.

Powertools JMESPath functions

You can use our built-in JMESPath functions within your envelope expression. They handle deserialization for common data formats found in AWS Lambda event sources such as JSON strings, base64, and uncompress gzip data.

powertools_json function idempotency example

Use powertools_json function to decode any JSON string anywhere a JMESPath expression is allowed.

Example of using JMESPath with Idempotency to create the idempotent key

Idempotency.Configure(builder =>
 builder
 .WithOptions(optionsBuilder =>
 optionsBuilder.WithEventKeyJmesPath("powertools_json(Body).[\"user_id\", \"product_id\"]"))
 .UseDynamoDb("idempotency_table"));
{
 "version": "2.0",
 "routeKey": "ANY /createpayment",
 "rawPath": "/createpayment",
 "rawQueryString": "",
 "headers": {
 "Header1": "value1",
 "Header2": "value2"
 },
 "requestContext": {
 "accountId": "123456789012",
 "apiId": "api-id",
 "domainName": "id.execute-api.us-east-1.amazonaws.com",
 "domainPrefix": "id",
 "http": {
 "method": "POST",
 "path": "/createpayment",
 "protocol": "HTTP/1.1",
 "sourceIp": "ip",
 "userAgent": "agent"
 },
 "requestId": "id",
 "routeKey": "ANY /createpayment",
 "stage": "$default",
 "time": "10/Feb/2021:13:40:43 +0000",
 "timeEpoch": 1612964443723
 },
 "body": "{\"user_id\":\"xyz\",\"product_id\":\"123456789\"}",
 "isBase64Encoded": false
}

Changes

🌟New features and non-breaking changes

📜 Documentation updates

🔧 Maintenance

This release was made possible by the following contributors:

Code and inspiration from jdevillard/JmesPath.Net and danielaparker/JsonCons.Net

@hjgraca and @amirkaws


This discussion was created from the release 1.10.0.
You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /