You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: Support Form object in APIGatewayRestResolver #7024
I’m building a multi-region AWS Lambda API that accepts:
Custom headers for client identification (e.g., X-Customer-Id)
Multipart/form-data uploads (CSV files up to 5 MB)
Today Powertools’ APIGatewayRestResolver generates an OpenAPI spec that omits header parameters and file/form bodies, so our consumers cannot rely on the spec for validation or client generation. We end up hand-editing the JSON, which breaks the “single-source-of-truth” goal of Powertools.
Solution/User Experience
Extend OpenAPIConverter so that when a handler parameter is typed as File or bytes (or annotated with content_type="multipart/form-data"), it generates the correct OpenAPI 3.0 schema:
requestBody:
content:
multipart/form-data:
schema:
type: objectproperties:
file:
type: stringformat: binaryAdd header-parameter supportparameters:
- in: headername: X-Customer-Idschema:
type: stringrequired: true### Alternative solutions```markdownAlternative solutions(third text-area lower down)markdownWe can manually patch the generated OpenAPI JSON or maintain a separate spec file, but that loses all the benefits of automatic generation and risks drift between code and documentation.
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link
We already have an issue open for this and I can link it here.
Please let me know if you need any help when implementing it. Feel free to submit a PR even you think the code is not complete, we can work together to get it merged.
changed the title [-]Feature request: Support header & multipart/form-data in APIGatewayRestResolver[/-][+]Feature request: Support Form object in APIGatewayRestResolver[/+]on Jul 28, 2025
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Activity
boring-cyborg commentedon Jul 22, 2025
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link
oyiz-michael commentedon Jul 22, 2025
Happy to implement—let me know if any changes needed.
leandrodamascena commentedon Jul 23, 2025
Hey @oyiz-michael thanks a lot for opening this issue! Actually we support headers (https://docs.powertools.aws.dev/lambda/python/latest/core/event_handler/api_gateway/#validating-headers) but we don't support form/files in the OpenAPI spec yet. I'd love to have your contribution here!
We already have an issue open for this and I can link it here.
Please let me know if you need any help when implementing it. Feel free to submit a PR even you think the code is not complete, we can work together to get it merged.
[-]Feature request: Support header & multipart/form-data in APIGatewayRestResolver[/-][+]Feature request: Support Form object in APIGatewayRestResolver[/+]powertools-for-aws-oss-automation commentedon Jul 28, 2025
Warning
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
github-actions commentedon Jul 29, 2025
This is now released under 3.18.0 version!