Skip to content
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

When using APIExplorer the ControllerType is incorrect and version appears incomplete #1294

Closed
giggio opened this issue Apr 21, 2018 · 6 comments
Milestone

Comments

@giggio
Copy link
Contributor

giggio commented Apr 21, 2018

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.

@RicoSuter
Copy link
Owner

Thanks for reporting. The goal is to make the ApiExplorer generator output as similar as possible to the old generator so that we can deprecate the reflection based generator eventually and give the users an easy way to migrate to the new generator...

I think version handling is not really good supported by the old generator, so maybe we can improve it in both generators and streamline the output?

There are probably a lot of other differences which have to be fixed before we can remove the experimental status of the api explorer generator...

If you are willing to help, it would be great!

For more info, see #999

@RicoSuter
Copy link
Owner

But I think your problem may not be covered... We need to add tests for that first...

@giggio
Copy link
Contributor Author

giggio commented Jun 28, 2018

I just tried with the latest version on Nuget 11.17.17 and the same problems still happen.

@giggio
Copy link
Contributor Author

giggio commented 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.

@giggio
Copy link
Contributor Author

giggio commented 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!

@giggio giggio closed this as completed Jan 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants