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 | 160 |
Tags |
ASP.NET
|
I'm building here a library of useful solutions to software development problems.
If you like this project, create an account or add a bookmark, then come back here to write a post yourself when you run into something that might be useful to others...
>> read more