Closed
Description
Expected Behaviour
When I generate OpenAPI specs, I'm expecting the paths to follow the specification on Path templating.
Current Behaviour
For legacy reasons, Powertools generates OpenAPI specs containing <>
(e.g: /todos/<todo_id>
) which breaks any tool that uses the standard spec.
Code snippet
from aws_lambda_powertools.event_handler import APIGatewayRestResolver
app = APIGatewayRestResolver(enable_validation=True)
@app.get("/todos/<todo_id>")
def handle(todo_id: int):
print(todo_id)
return "hello"
def lambda_handler(event, context):
app.resolve(event, context)
print(app.get_openapi_json_schema())
Possible Solution
Keep the existing behaviour, but change the OpenAPI spec to emit the correct standard
Steps to Reproduce
- Use the code snippet above.
- Use Swagger to visualize the API
- Try to invoke
/todos/1
- Result: Swagger doesn't know how to map 1 to
<todo_id>
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.7
Packaging format used
PyPi
Debugging logs
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Shipped