-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
filter out the APIs being documented by NSwag in ASP.NET Core MVC #1361
Comments
More info on how I ended up here: I can see that When you look at the |
NSwag has two generators: One is completely reflection based (default) and the never one API explorer based (this one will eventually be the default). Either you use the reflection based generator and filter with an operation processor or you switch to the new generator: #999 i.e. UseSwagger*WithApiExplorer(), AspNetCoreToSwaggerGenerator, etc. |
Hmm ok, that is strange... maybe you have to deregister the old provider? |
hmm, I cannot see |
I would love to switch to a new generator if possible but cannot find how. |
Q: How did you integrate NSwag into your project? |
Great, |
I initially added these two calls during app startup:
but now switched to |
Thanks for the help @RSuter! I have also opened up dotnet/AspNetCore.Docs#6785 before. Would be lovely to provide documentation there about this. If I get my sample working, I can try to see if I can provide it there, too. |
Important: UseSwaggerUi3 also contains UseSwagger, no need to specify both (may cause problems) and in services you need to add AddSwagger() |
lovely, did that now!
Doing this now as well but it was working w/o this anyway 🤔 |
AddSwagger() is only needed for the new UseSwagger*WithApiExplorer() methods |
I am trying to filter out the APIs being documented by NSwag inside an ASP.NET Core MVC application but it seems to be failing so far. I used the following custom
IActionDescriptorCollectionProvider
which seems to be picked up by ASP.NET Core MVC but not by NSwag.Then, I registered this like below:
This is just for a sample as you can see it hides all the actions but with this I expected NSwag to document nothing.
What's the recommended way to filter out APIs to be documented in NSwag based on a condition? I can see the SwaggerIgnoreAttribute but I cannot apply that based on a condition.
The text was updated successfully, but these errors were encountered: