Skip to content
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

feat(event_handler): add custom method for OpenAPI configuration #6204

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

leandrodamascena
Copy link
Contributor

Issue number: #6122

Summary

Changes

This PR introduces a new method configure_openapi() to simplify OpenAPI configuration while maintaining backwards compatibility.

Currently, OpenAPI configuration must be specified in both enable_swagger() and get_openapi_json_schema() methods, leading to:

  • Duplication of configuration
  • Inconsistent documentation when configurations differ
  • More complex maintenance

User experience

Introduce a new configure_openapi() method while preserving existing functionality:

from aws_lambda_powertools.event_handler import APIGatewayRestResolver

app = APIGatewayRestResolver(enable_validation=True)
# New configuration approach
app.configure_openapi(
    title="My API",
    version="1.0.0",
    description="API Description"
)

# Existing methods continue to work
app.enable_swagger(path="/docs")  # Uses configured values

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

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

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@leandrodamascena leandrodamascena requested a review from a team as a code owner March 3, 2025 16:55
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 3, 2025
@leandrodamascena leandrodamascena linked an issue Mar 3, 2025 that may be closed by this pull request
2 tasks
@leandrodamascena leandrodamascena self-assigned this Mar 3, 2025
@github-actions github-actions bot added feature New feature or functionality and removed internal Maintenance changes labels Mar 3, 2025
Copy link

codecov bot commented Mar 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.31%. Comparing base (bbb875c) to head (863d6f9).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #6204      +/-   ##
===========================================
+ Coverage    96.30%   96.31%   +0.01%     
===========================================
  Files          240      241       +1     
  Lines        11572    11612      +40     
  Branches       858      861       +3     
===========================================
+ Hits         11144    11184      +40     
  Misses         336      336              
  Partials        92       92              

☔ View full report in Codecov by Sentry.
📢 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.

@boring-cyborg boring-cyborg bot added the internal Maintenance changes label Mar 3, 2025
@github-actions github-actions bot removed the internal Maintenance changes label Mar 3, 2025
@boring-cyborg boring-cyborg bot added the internal Maintenance changes label Mar 3, 2025
@github-actions github-actions bot removed the internal Maintenance changes label Mar 3, 2025
@boring-cyborg boring-cyborg bot added documentation Improvements or additions to documentation internal Maintenance changes labels Mar 3, 2025
@github-actions github-actions bot removed documentation Improvements or additions to documentation internal Maintenance changes labels Mar 3, 2025
@boring-cyborg boring-cyborg bot added documentation Improvements or additions to documentation internal Maintenance changes labels Mar 3, 2025
@github-actions github-actions bot removed documentation Improvements or additions to documentation internal Maintenance changes labels Mar 3, 2025
@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Mar 7, 2025
@boring-cyborg boring-cyborg bot added the internal Maintenance changes label Mar 7, 2025
@github-actions github-actions bot removed documentation Improvements or additions to documentation internal Maintenance changes labels Mar 7, 2025
@boring-cyborg boring-cyborg bot added documentation Improvements or additions to documentation internal Maintenance changes labels Mar 9, 2025
@github-actions github-actions bot removed documentation Improvements or additions to documentation internal Maintenance changes labels Mar 9, 2025
@boring-cyborg boring-cyborg bot added documentation Improvements or additions to documentation internal Maintenance changes labels Mar 10, 2025
@github-actions github-actions bot removed documentation Improvements or additions to documentation internal Maintenance changes labels Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event_handlers feature New feature or functionality size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Improve OpenAPI configuration with a common method
1 participant