-
Notifications
You must be signed in to change notification settings - Fork 709
Wrong route variable replacing + language questions #419
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
Comments
I'm sorry, i've found mistake in IIS rewrite rules (406 gave me a hint), so the second question is solved - routes with v1 corrrectly resolving. But i'm still have problem with language tag. |
There are two issues here; one causing the other. Ultimately, this is happening because you are missing the [HttpGet]
[Route]
[ResponseType(typeof(TestResult))]
public IHttpActionResult Get(string language) { /* omitted */ } In addition, the logic to generate the API parameter description for an API version in the path looks for an existing partial parameter description. The parameter description is always consistently missing some information because the API version is usually not model bound. Because the This shouldn't be a landmine that's so easy to step on. After a quick investigation, it's possible to make the API Explorer logic more reliable to avoid this type of situation. I'll put out a patch when I can. In the meantime, simply update your action definition and you should be on your way. |
…parameter reliable. Related #419
…parameter reliable. Related #419
Thanks for response! |
…parameter reliable. Related #419
I see. I thought you might have been able to work around this issue without an update, but it seems not. I've published the fix in 3.0.1 of the API Explorer. Indexing and such on the NuGet site isn't done yet, so might have to explicitly update the version or restore by command line. This version should appear in searches within the next 15 minutes. I was able to repro your scenario, so I expect this change to resolve the issue for you. Let me know one way or the other. Thanks. |
Thanks! It works perfectly! |
Seems like this issue is resolved now. Feel free to come back if you have more questions or issues. Thanks! |
Hi, guys.
I'm moving from SDammann.Versioning lib to this project and the process of configuration is better and running more smoothly. Thanks contributors for a great work. As for API itself all is working great, but i have two questions while trying configure the swagger/swashbuckle.
I have removed all conventional routing and left only attribute based one. Currently my route prefix for controllers looks like {language:regex(ru|en|es)}/api/v{version:apiVersion}
I'm configuring my app with the following code:
And i have the next controller:
After running app and opening swagger i'm seeing the next route:

RoutePrefix = "en/api/v{version:apiVersion}/"
then the version tag is substituting for v1. But request from swagger not working nevertheless - it's going on "en/api/v1/test", but the application returns 406.0 - Not Acceptable, it's awaiting request on "en/api/v1.0/test". How can setup swagger correctly?
I have ASP.Net WebAPI 2 project (.net 4.7.2.) with Swashbuckle 5.6.0 & Microsoft.AspNet.WebApi.Versioning.ApiExplorer 3.0.0
I've found this issue: #113, but for now i can't use approach with headers due to neccessity of backward compatibility.
I'll appreciate any help.
The text was updated successfully, but these errors were encountered: