locked
Not showing Obsolete within WebApi2 help page RRS feed

  • Question

  • User-1608281605 posted

    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

    Friday, May 8, 2020 7:41 PM

All replies

  • User475983607 posted

    david@windward.net

    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

    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

    Friday, May 8, 2020 8:50 PM
  • User-1608281605 posted

    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

    Saturday, May 9, 2020 7:32 PM
  • User-1084200161 posted

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

    Friday, May 22, 2020 3:34 PM
  • User-1608281605 posted

    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

    Tuesday, May 26, 2020 3:11 PM