Base solution for your next web application
Open Closed

Hide specific API's only from Swagger UI #4755


User avatar
0
bolenton created

Hi,

I want to hide some API's only on Swagger UI but these hidden should be called from client script(Javascript).

I want to hide all the inbuilt API's of Asp.Net zero and show only the API's written by me. These hidden API's should work whenever we call from the script.

I have tried some options like setting the attribute on the appservices/methods:

  1. [ApiExplorerSettings(IgnoreApi = true)]
  2. [RemoteService(IsMetadataEnabled = false)]

These works well for hiding them on Swagger but, they no more exists while calling such appservices from the javascript.

Thnaks.


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can take a look at Document Filters and Operation Filters

    <a class="postlink" href="https://github.com/domaindrivendev/Swashbuckle#documentfilter">https://github.com/domaindrivendev/Swas ... mentfilter</a> <a class="postlink" href="https://github.com/domaindrivendev/Swashbuckle#operationfilter">https://github.com/domaindrivendev/Swas ... tionfilter</a>

  • User Avatar
    0
    alper created
    Support Team

    if you hide the endpoint from Swagger then proxy generation will break. but there must be some options to run JS code when the swagger UI splashes. basically you can run a JS method and hide those you don't want.