Skip to content

Commit b67e440

Browse files
committed
Merge branch 'improv/event-source-return-type' of https://github.com/robmoss2k/powertools-lambda-python into improv/event-source-return-type
2 parents defc31a + c96e80b commit b67e440

25 files changed

+149
-133
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
steps:
3030
- name: Checkout repository
31-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
31+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
3232

3333
# Initializes the CodeQL tools for scanning.
3434
- name: Initialize CodeQL

.github/workflows/dependency-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: 'Checkout Repository'
20-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
20+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
2121
- name: 'Dependency Review'
2222
uses: actions/dependency-review-action@5bbc3ba658137598168acb2ab73b21c432dd411b # v4.2.5

.github/workflows/label_pr_on_title.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
pull-requests: write # label respective PR
5151
steps:
5252
- name: Checkout repository
53-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
53+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
5454
- name: "Label PR based on title"
5555
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
5656
env:

.github/workflows/on_label_added.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
permissions:
4848
pull-requests: write # comment on PR
4949
steps:
50-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
50+
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
5151
# Maintenance: Persist state per PR as an artifact to avoid spam on label add
5252
- name: "Suggest split large Pull Request"
5353
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1

.github/workflows/on_merged_pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
issues: write # label issue with pending-release
5050
if: needs.get_pr_details.outputs.prIsMerged == 'true'
5151
steps:
52-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
52+
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
5353
- name: "Label PR related issue for release"
5454
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
5555
env:

.github/workflows/on_opened_pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
needs: get_pr_details
4848
runs-on: ubuntu-latest
4949
steps:
50-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
50+
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
5151
- name: "Ensure related issue is present"
5252
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
5353
env:
@@ -66,7 +66,7 @@ jobs:
6666
permissions:
6767
pull-requests: write # label and comment on PR if missing acknowledge section (requirement)
6868
steps:
69-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
69+
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
7070
- name: "Ensure acknowledgement section is present"
7171
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
7272
env:

.github/workflows/on_schedule_monthly_roadmap_reminder.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,3 @@ jobs:
1616
uses: aws-powertools/actions/.github/workflows/monthly_roadmap_reminder.yml@fd4575466e5c2ac10703ac16f5aa9fb8890f532a
1717
with:
1818
token: ${{ github.token }}
19-
20-

.github/workflows/ossf_scorecard.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222

2323
steps:
2424
- name: "Checkout code"
25-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
25+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
2626
with:
2727
persist-credentials: false
2828

@@ -35,7 +35,7 @@ jobs:
3535
repo_token: ${{ secrets.SCORECARD_TOKEN }} # read-only fine-grained token to read branch protection settings
3636

3737
- name: "Upload results"
38-
uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba # v4.3.2
38+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
3939
with:
4040
name: SARIF file
4141
path: results.sarif

.github/workflows/publish_v2_layer.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
working-directory: ./layer
8989
steps:
9090
- name: checkout
91-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
91+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
9292
with:
9393
ref: ${{ env.RELEASE_COMMIT }}
9494

@@ -146,7 +146,7 @@ jobs:
146146
- name: zip output
147147
run: zip -r cdk.out.zip cdk.out
148148
- name: Archive CDK artifacts
149-
uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba # v4.3.2
149+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
150150
with:
151151
name: cdk-layer-artefact
152152
path: layer/cdk.out.zip
@@ -247,7 +247,7 @@ jobs:
247247
pages: none
248248
steps:
249249
- name: Checkout repository # reusable workflows start clean, so we need to checkout again
250-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
250+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
251251
with:
252252
ref: ${{ env.RELEASE_COMMIT }}
253253

@@ -258,7 +258,7 @@ jobs:
258258
artifact_name: ${{ inputs.source_code_artifact_name }}
259259

260260
- name: Download CDK layer artifacts
261-
uses: actions/download-artifact@8caf195ad4b1dee92908e23f56eeb0696f1dd42d # v4.1.5
261+
uses: actions/download-artifact@9c19ed7fe5d278cd354c7dfd5d3b88589c7e2395 # v4.1.6
262262
with:
263263
path: cdk-layer-stack
264264
pattern: cdk-layer-stack-* # merge all Layer artifacts created per region earlier (reusable_deploy_v2_layer_stack.yml; step "Save Layer ARN artifact")

.github/workflows/quality_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
permissions:
5151
contents: read # checkout code only
5252
steps:
53-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
53+
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
5454
- name: Install poetry
5555
run: pipx install poetry
5656
- name: Set up Python ${{ matrix.python-version }}

.github/workflows/quality_check_pydanticv2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
permissions:
5050
contents: read # checkout code only
5151
steps:
52-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
52+
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
5353
- name: Install poetry
5454
run: pipx install poetry
5555
- name: Set up Python ${{ matrix.python-version }}

.github/workflows/record_pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ jobs:
4646
permissions:
4747
contents: read # NOTE: treat as untrusted location
4848
steps:
49-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
49+
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
5050
- name: "Extract PR details"
5151
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
5252
with:
5353
script: |
5454
const script = require('.github/scripts/save_pr_details.js')
5555
await script({github, context, core})
56-
- uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba # v4.3.2
56+
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
5757
with:
5858
name: pr
5959
path: pr.txt

.github/workflows/release.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
RELEASE_VERSION="${RELEASE_TAG_VERSION:1}"
8181
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "$GITHUB_OUTPUT"
8282
83-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
83+
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
8484
with:
8585
ref: ${{ env.RELEASE_COMMIT }}
8686

@@ -115,7 +115,7 @@ jobs:
115115
contents: read
116116
steps:
117117
# NOTE: we need actions/checkout to configure git first (pre-commit hooks in make dev)
118-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
118+
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
119119
with:
120120
ref: ${{ env.RELEASE_COMMIT }}
121121

@@ -156,7 +156,7 @@ jobs:
156156
attestation_hashes: ${{ steps.encoded_hash.outputs.attestation_hashes }}
157157
steps:
158158
# NOTE: we need actions/checkout to configure git first (pre-commit hooks in make dev)
159-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
159+
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
160160
with:
161161
ref: ${{ env.RELEASE_COMMIT }}
162162

@@ -225,7 +225,7 @@ jobs:
225225
RELEASE_VERSION: ${{ needs.seal.outputs.RELEASE_VERSION }}
226226
steps:
227227
# NOTE: we need actions/checkout in order to use our local actions (e.g., ./.github/actions)
228-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
228+
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
229229
with:
230230
ref: ${{ env.RELEASE_COMMIT }}
231231

@@ -259,7 +259,7 @@ jobs:
259259
contents: write
260260
steps:
261261
# NOTE: we need actions/checkout to authenticate and configure git first
262-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
262+
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
263263
with:
264264
ref: ${{ env.RELEASE_COMMIT }}
265265

@@ -303,7 +303,7 @@ jobs:
303303
runs-on: ubuntu-latest
304304
steps:
305305
# NOTE: we need actions/checkout to authenticate and configure git first
306-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
306+
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
307307
with:
308308
ref: ${{ env.RELEASE_COMMIT }}
309309

@@ -357,7 +357,7 @@ jobs:
357357
env:
358358
RELEASE_VERSION: ${{ needs.seal.outputs.RELEASE_VERSION }}
359359
steps:
360-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
360+
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
361361
with:
362362
ref: ${{ env.RELEASE_COMMIT }}
363363

.github/workflows/reusable_deploy_v2_layer_stack.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ jobs:
140140
has_arm64_support: "true"
141141
steps:
142142
- name: checkout
143-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
143+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
144144
with:
145145
ref: ${{ env.RELEASE_COMMIT }}
146146

@@ -180,7 +180,7 @@ jobs:
180180
- name: install deps
181181
run: poetry install
182182
- name: Download artifact
183-
uses: actions/download-artifact@8caf195ad4b1dee92908e23f56eeb0696f1dd42d # v4.1.5
183+
uses: actions/download-artifact@9c19ed7fe5d278cd354c7dfd5d3b88589c7e2395 # v4.1.6
184184
with:
185185
name: ${{ inputs.artefact-name }}
186186
path: layer
@@ -197,7 +197,7 @@ jobs:
197197
cat cdk-layer-stack/${{ matrix.region }}-layer-version.txt
198198
- name: Save Layer ARN artifact
199199
if: ${{ inputs.stage == 'PROD' }}
200-
uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba # v4.3.2
200+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
201201
with:
202202
name: cdk-layer-stack-${{ matrix.region }}
203203
path: ./layer/cdk-layer-stack/* # NOTE: upload-artifact does not inherit working-directory setting.

.github/workflows/reusable_deploy_v2_sar.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
architecture: ["x86_64", "arm64"]
8080
steps:
8181
- name: checkout
82-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
82+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
8383
with:
8484
ref: ${{ env.RELEASE_COMMIT }}
8585

@@ -115,7 +115,7 @@ jobs:
115115
with:
116116
node-version: ${{ env.NODE_VERSION }}
117117
- name: Download artifact
118-
uses: actions/download-artifact@8caf195ad4b1dee92908e23f56eeb0696f1dd42d # v4.1.5
118+
uses: actions/download-artifact@9c19ed7fe5d278cd354c7dfd5d3b88589c7e2395 # v4.1.6
119119
with:
120120
name: ${{ inputs.artefact-name }}
121121
- name: Unzip artefact

.github/workflows/reusable_export_pr_details.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
prLabels: ${{ steps.prLabels.outputs.prLabels }}
7777
steps:
7878
- name: Checkout repository # in case caller workflow doesn't checkout thus failing with file not found
79-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
79+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
8080
- name: "Download previously saved PR"
8181
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
8282
env:

.github/workflows/reusable_publish_changelog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
pull-requests: write # create PR
2727
steps:
2828
- name: Checkout repository # reusable workflows start clean, so we need to checkout again
29-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
29+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
3030
with:
3131
fetch-depth: 0
3232
- name: "Generate latest changelog"

.github/workflows/reusable_publish_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
id-token: write # trade JWT token for AWS credentials in AWS Docs account
4545
pages: write # uncomment if mike fails as we migrated to S3 hosting
4646
steps:
47-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
47+
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
4848
with:
4949
fetch-depth: 0
5050
ref: ${{ inputs.git_ref }}

.github/workflows/run-e2e-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
if: ${{ github.actor != 'dependabot[bot]' && github.repository == 'aws-powertools/powertools-lambda-python' }}
5252
steps:
5353
- name: "Checkout"
54-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
54+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
5555
- name: Install poetry
5656
run: pipx install poetry
5757
- name: "Use Python"

.github/workflows/secure_workflows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
contents: read # checkout code and subsequently GitHub action workflows
3131
steps:
3232
- name: Checkout code
33-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
33+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
3434
- name: Ensure 3rd party workflows have SHA pinned
3535
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@19ebcb0babbd282ae1822a0b9c28f3f1f25cea45 # v3.0.4
3636
with:

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@
1010

1111
## Maintenance
1212

13+
* **deps:** bump actions/upload-artifact from 4.3.1 to 4.3.2 ([#4162](https://github.com/aws-powertools/powertools-lambda-python/issues/4162))
14+
* **deps:** bump actions/checkout from 4.1.2 to 4.1.3 ([#4168](https://github.com/aws-powertools/powertools-lambda-python/issues/4168))
15+
* **deps:** bump actions/download-artifact from 4.1.4 to 4.1.5 ([#4161](https://github.com/aws-powertools/powertools-lambda-python/issues/4161))
16+
* **deps-dev:** bump ruff from 0.3.7 to 0.4.1 ([#4166](https://github.com/aws-powertools/powertools-lambda-python/issues/4166))
17+
* **deps-dev:** bump aws-cdk from 2.137.0 to 2.138.0 ([#4157](https://github.com/aws-powertools/powertools-lambda-python/issues/4157))
18+
* **deps-dev:** bump aws-cdk-lib from 2.137.0 to 2.138.0 ([#4160](https://github.com/aws-powertools/powertools-lambda-python/issues/4160))
19+
* **deps-dev:** bump cdklabs-generative-ai-cdk-constructs from 0.1.119 to 0.1.121 ([#4167](https://github.com/aws-powertools/powertools-lambda-python/issues/4167))
20+
* **deps-dev:** bump aws-cdk-aws-lambda-python-alpha from 2.137.0a0 to 2.138.0a0 ([#4169](https://github.com/aws-powertools/powertools-lambda-python/issues/4169))
21+
* **deps-dev:** bump cdklabs-generative-ai-cdk-constructs from 0.1.121 to 0.1.123 ([#4176](https://github.com/aws-powertools/powertools-lambda-python/issues/4176))
1322

1423

1524
<a name="v2.37.0"></a>

aws_lambda_powertools/utilities/parser/parser.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,17 @@ def handler(event: Order, context: LambdaContext):
8383
When envelope given does not implement BaseEnvelope
8484
"""
8585

86-
# The first parameter of a Lambda function is always the event
87-
# This line get the model informed in the event_parser function
88-
# or the first parameter of the function by using typing.get_type_hints
89-
type_hints = typing.get_type_hints(handler)
90-
model = model or (list(type_hints.values())[0] if type_hints else None)
9186
if model is None:
92-
raise InvalidModelTypeError(
93-
"The model must be provided either as the `model` argument to `event_parser`"
94-
"or as the type hint of `event` in the handler that it wraps",
95-
)
87+
# The first parameter of a Lambda function is always the event.
88+
# Get the first parameter's type by using typing.get_type_hints.
89+
type_hints = typing.get_type_hints(handler)
90+
if type_hints:
91+
model = list(type_hints.values())[0]
92+
if model is None:
93+
raise InvalidModelTypeError(
94+
"The model must be provided either as the `model` argument to `event_parser`"
95+
"or as the type hint of `event` in the handler that it wraps",
96+
)
9697

9798
if envelope:
9899
parsed_event = parse(event=event, model=model, envelope=envelope)

0 commit comments

Comments
 (0)