-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: Invalid return type in middleware example #3556
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
Hello @kamilturek! Thanks for opening this issue! Static type checking in Python is sometimes challenging. We use I'm not the biggest mypy expert out there, but from what I understand, our examples don't fail because we're not noting typing the Would you like to open a PR to fix this? We try to make our documentation as assertive as possible for our customers; this case is certainly something we need to fix quickly. thanks. |
Hey @leandrodamascena, thanks for looking into this and verifying my report. I'd be very happy to create a PR. Will do it soon. Thanks. |
|
What were you searching in the docs?
All examples on the middleware factory page present a middleware function with return type of
Callable
which seems incorrect.The actual return type of the
middleware_before
function is the same as the one of the lambda handler -dict
this case. Only after the function is decorated, it'll be aCallable
but I believe the function definition should anyway have the return type ofdict
.A small reproducible example:
Mypy output:
Is this related to an existing documentation section?
https://docs.powertools.aws.dev/lambda/python/latest/utilities/middleware_factory/#middleware-with-before-logic
How can we improve?
All invalid examples should be updated with correct return types (seems like
dict
in all cases).Got a suggestion in mind?
I'm happy to help with resolving this issue.
Acknowledgment
The text was updated successfully, but these errors were encountered: