question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When using APIExplorer the ControllerType is incorrect and version appears incomplete

See original GitHub issue

After #1288 was completed I was able to test NSwag with and without API Explorer, and I found a few differences. So, my controller is inheriting from another controller, and that is what #1288 fixed. But the name that shows up is the name of the controller that has the original operation, not from the one that inherited it.

Also, the version appears as “v1.0” without API Explorer, but only as “v1” with API Explorer. I am not sure why.

Bellow you can see both without API Explorer (1st image) and with (2nd image):

without API Explorer

with API Explorer

Also, to only show v1 and v2 on specific pages, I add NSwag several times, one for each version (with different routes), and then I am doing this:

if (!string.IsNullOrWhiteSpace(version))
  generatorSettings.OperationProcessors.OfType<ApiVersionProcessor>().Single().IncludedVersions.Add(version);

(I am not sure this is the expected way to do it… anyway)

But, as the versions are showing up differently (v1.0 vs v1), all operations are shown, as you can see on the second image. I am sure that this is happening because of this line, which returns null: https://github.com/RSuter/NSwag/blob/c44d37206e65b7271cad4c7180c5e6724e65c449/src/NSwag.SwaggerGeneration/Processors/ApiVersionProcessor.cs#L47

So, there are these 2 differences from using API Explorer or not.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
giggiocommented, Jan 18, 2019

After updating to version 12 everything is working as expected. Also, the code is overall much simpler. The new version is cool! Thanks!

0reactions
giggiocommented, Oct 14, 2018

Hi, just coming back here to report the status after testing it with version 11.20.1. I am getting the same results.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support API Explorer
XML Request sample is not generated in the UI #1392 opened by munafk project: NSwag.AspNet project: NSwag.AspNetCore type: bug. From To do.
Read more >
Keep getting AmbiguousMatchExceptions with aspnet-api- ...
This is happening because the setup is incomplete. It should be: builder.Services.AddApiVersioning().AddMvc();. The names are intentionally ...
Read more >
Exception is raised when 2 controller routes and a named ...
i have this webapi controller: using Microsoft.AspNetCore.Mvc; namespace Crud.Controllers { [ApiController] [Produces("application/json")] ...
Read more >
workstation-pro-16-user-guide.pdf
When you use the trial version of VMware Workstation Pro, a notice appears on the home page advising you of the trial license...
Read more >
Using VMware Workstation Player for Windows
Workstation Player is a desktop application that lets you create, configure, and run virtual machines. You can also use Workstation Player to download...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found