Skip to content

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

Closed

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:

Image

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!

Activity

  1. boring-cyborg commented on Dec 1, 2024

    @boring-cyborg

    Thanks for opening your first issue here! We'll come back to you as soon as we can.
    In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

  2. anafalcao commented on Dec 10, 2024

    @anafalcao
    Contributor

    Hi @tcysin ! Thanks for opening this feature request, and sorry for the delay, we were at re:invent last week.
    Would you like to open a PR with your solution or do you prefer us to work on it and come back to you?

  3. self-assigned this
    on Dec 10, 2024
  4. tcysin commented on Dec 12, 2024

    @tcysin
    ContributorAuthor

    It's all good 👍
    Yeah, I'm giving it a try.

  5. github-actions commented on Dec 19, 2024

    @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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions