Robyn icon indicating copy to clipboard operation
Robyn copied to clipboard

Add a deprecation_message field in the get/post/put decorators

Open sansyrox opened this issue 2 years ago • 1 comments

Issue:

We currently lack a way to notify consumers of our API about deprecated endpoints directly through the API responses. To improve communication about deprecated or soon-to-be removed functionality, it would be beneficial to add a deprecation_message field to our GET/POST/PUT decorators.

Expected Behavior:

When a client makes a request to a deprecated endpoint, the response should include a clear deprecation_message. This would give API consumers the necessary information about the status of the endpoint and any actions they need to take.

sansyrox avatar Apr 19 '23 17:04 sansyrox

Would be interested in giving this a go as a first issue, just to confirm, this is essentially allowing an optional arg (deprecation message) to be passed to the decorator which then shows in the response for that endpoint?

Edit:

As an example from the test routes in integration_tests/base_routes.py:

@app.get("/sync/str")
def sync_str_get():
    return "sync str get"

This should now look like:

@app.get("/sync/str", deprecation_message = "Don't use me")
def sync_str_get():
    return "sync str get"

And the response should look like what exactly? Would it make most sense to add this as a header?

Sammo98 avatar Aug 26 '23 19:08 Sammo98