Closed
Description
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
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Shipped