That mostly works. It removes an API. For an API, setting it for a model class property removes it from the Body Parameters. However, in the sample formats, while it removes it from the XML sample, it does display it in the JSON sample.
Also, to go to my original question, is there a way to do this using the Obsolete attribute? It’s not only inefficient to have to go add this attribute ~ 50 places, but it’s easy in the future to forget to put both attributes. (And if not, thank you as this
will work.)
Member
24 Points
247 Posts
Not showing Obsolete within WebApi2 help page
May 08, 2020 07:41 PM|david@windward.net|LINK
Is there a way to have the help created from the XML documentation to not show items tagged with the Obsolete attribute?
Or at least have them display that they're obsolete?
thanks - dave
All-Star
53041 Points
23611 Posts
Re: Not showing Obsolete within WebApi2 help page
May 08, 2020 08:50 PM|mgebhard|LINK
You can place whatever you like int the comments but the obsolete attribute is the standard.
https://docs.microsoft.com/en-us/dotnet/api/system.obsoleteattribute?view=netcore-3.1
Member
24 Points
247 Posts
Re: Not showing Obsolete within WebApi2 help page
May 09, 2020 07:32 PM|david@windward.net|LINK
That's what I did, but it's not having any impact - see below source code and then displayed help.
Is there some setting I need to make? Preferably to not show obsolete URLs and model members?![]()
??? - thanks - dave
Member
520 Points
304 Posts
Re: Not showing Obsolete within WebApi2 help page
May 22, 2020 03:34 PM|Radomir|LINK
Would this help:
https://docs.microsoft.com/en-us/aspnet/web-api/overview/getting-started-with-aspnet-web-api/creating-api-help-pages#under-the-hood
It says: 'To hide an API from the ApiExplorer, add the ApiExplorerSettings attribute to the action and set IgnoreApi to true."
Member
24 Points
247 Posts
Re: Not showing Obsolete within WebApi2 help page
May 26, 2020 03:11 PM|david@windward.net|LINK
Hi;
That mostly works. It removes an API. For an API, setting it for a model class property removes it from the Body Parameters. However, in the sample formats, while it removes it from the XML sample, it does display it in the JSON sample.
Also, to go to my original question, is there a way to do this using the Obsolete attribute? It’s not only inefficient to have to go add this attribute ~ 50 places, but it’s easy in the future to forget to put both attributes. (And if not, thank you as this will work.)
thanks - dave