Skip to content

Feature request: Mark API operation as deprecated for OpenAPI documentation #5674

Closed
@tcysin

Description

@tcysin

Use case

When customizing API operations, I'd like to be able to mark an operation as deprecated (see Operation Object, OAS v3.0.3).

This helps to tell the users that an operation will be, well, deprecated. Here's what it looks like with Petstore example in Swagger Editor:

Solution/User Experience

An extra deprecated boolean parameter with a False default:

from aws_lambda_powertools.event_handler import APIGatewayRestResolver
from aws_lambda_powertools.event_handler.api_gateway import Router

app = APIGatewayRestResolver()

@app.get("/spam", deprecated=True)
def spam(name):
    return {"message": "mmm... tasty"}

@app.get("/eggs")  # deprecated=False by default
def eggs(name):
    return {"message": "cheese"}

router = Router()

@router.get("/ham", deprecated=True)
def ham():
    return {"message": "ham!"}

Acknowledgment

Thanks for your hard work!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions