How to do this, in order to let developers know not to use it?
It should be clearly visible in Swagger (the default in Web API) too.
How to do this, in order to let developers know not to use it?
It should be clearly visible in Swagger (the default in Web API) too.
Just use the normal Obsolete
attribute in C# on the endpoint method:
[Obsolete("This endpoint is obsolete. Call /WeatherForecastAI instead.")]
[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> Get()
This will make the endpoint show up on Swagger as grayed out and with a strike-through:
I've also tried to use the Deprecated
property of ApiVersion
, but it didn't have any effect on Swagger.
(This is a simple thing, I posted it on A Dev just because I couldn't find something clear in my web searches.)
Last Edit | August 7, 2024 |
Created | August 7, 2024 |
Views | 150 |
Tags |
ASP.NET
|
Do you like this website?
Bookmark it and come back here to write a post yourself when you run into something shareable.
Early collaborators will get to own a part of the project (5 to 20%)... >> read more