Skip to content

Feature request: Add ability to expose a Swagger UI on the event handler #3253

@rubenfonseca

Description

@rubenfonseca
Contributor

Use case

This is a continuation of the work on the RFC #2421

Now that we've merged the code to add OpenAPI generation and runtime validation, we want to optionally enable a Swagger UI so the consumers can explore the API provided by the Lambda function.

NOTE: this ticket is not yet for customers using micro-functions. This is only useful for customers with a single Lambda with many routes.

Solution/User Experience

See here for the discussion.

We should create a new enable_swagger method on all the API resolvers that will create all the necessary endpoints to server the Swagger UI. Optionally the user can pass middlewares if additional security / authorization is needed.

app = APIGatewayRestResolver(enable_validation=True)
app.enable_swagger(path="/swagger")

Additional features include:

  • ability to override the Swagger base path, so other versions can be saved
  • ability to customize the OpenAPI metadata
  • automatic detection of the base path for Rest/Http gateways

Alternative solutions

N/A

Acknowledgment

  • This feature request meets Powertools for AWS Lambda (Python) Tenets
    Should this be considered in other Powertools for AWS Lambda languages? i.e. Java, TypeScript, and .NET

Activity

moved this from Triage to Working on it in Powertools for AWS Lambda (Python)on Oct 25, 2023
self-assigned this
on Oct 25, 2023
github-actions

github-actions commented on Nov 6, 2023

@github-actions
Contributor

⚠️COMMENT VISIBILITY 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 tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions

github-actions commented on Nov 10, 2023

@github-actions
Contributor

This is now released under 2.26.1 version!

moved this from Coming soon to Shipped in Powertools for AWS Lambda (Python)on Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

    Participants

    @rubenfonseca@leandrodamascena

    Issue actions

      Feature request: Add ability to expose a Swagger UI on the event handler · Issue #3253 · aws-powertools/powertools-lambda-python