Skip to content

fix(event_handler): omit Content-Type header from OpenAPI - #8374

Merged
leandrodamascena merged 2 commits into
aws-powertools:developfrom
DebadityaHait:fix/omit-content-type-openapi
Aug 10, 2026
Merged

fix(event_handler): omit Content-Type header from OpenAPI#8374
leandrodamascena merged 2 commits into
aws-powertools:developfrom
DebadityaHait:fix/omit-content-type-openapi

Conversation

@DebadityaHait

Copy link
Copy Markdown
Contributor

Issue number: Fixes #8347

Summary

Changes

  • omit the Content-Type header parameter from generated OpenAPI operations
  • keep Content-Type header fields in the runtime validation path
  • cover direct and Pydantic-model header declarations

User experience

Before, a route that used Body(media_type=application/json-patch+json) and a Literal[...] Content-Type header emitted both the correct request-body media type and a redundant in: header content-type parameter.

After, the request-body media type remains in requestBody.content, content-type is omitted from the generated parameter list, and runtime validation still returns 422 for an incorrect media type.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@DebadityaHait
DebadityaHait requested a review from a team as a code owner August 10, 2026 10:29
@boring-cyborg

boring-cyborg Bot commented Aug 10, 2026

Copy link
Copy Markdown

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

@powertools-for-aws-oss-automation powertools-for-aws-oss-automation Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 10, 2026
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.64%. Comparing base (ad15c7a) to head (c88a5a3).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #8374   +/-   ##
========================================
  Coverage    96.64%   96.64%           
========================================
  Files          296      296           
  Lines        14764    14765    +1     
  Branches      1245     1245           
========================================
+ Hits         14268    14269    +1     
  Misses         361      361           
  Partials       135      135           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leandrodamascena leandrodamascena left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @DebadityaHait

@mergify

mergify Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@leandrodamascena
leandrodamascena merged commit 715012f into aws-powertools:develop Aug 10, 2026
15 checks passed
@boring-cyborg

boring-cyborg Bot commented Aug 10, 2026

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

@powertools-for-aws-oss-automation

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

event_handlers size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: RestAPI event resolver: OpenAPI generation with content-type header generated wrong spec

2 participants