Skip to content

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

Closed
@rubenfonseca

Description

@rubenfonseca

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

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions