-
Notifications
You must be signed in to change notification settings - Fork 711
Multiple versions on the same controller #821
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
This is very strange indeed. I can confirm that I can reproduce the behavior. Order does not, nor ever, matters. The API version information is purely metadata and you can annotate it in any way you like. The collated lists are often sorted, but that is purely for sanity and optimizations when they are accessed later (ex: reporting API versions). Deprecated also does not matter. Deprecated or not, it's a matchable candidate. Deprecated just means the API version will go away. The stranger thing is that a similar configuration is used for People and both Debugging, I see the route is mapped and resolves to the correct endpoint. It's not clear how we get to 404? 😕 Continuing to research. There's a chance it's a bug, but I haven't been able to prove it - yet. Thanks for reporting the issue. |
Hmmmm, a mystery 🤔. Have you tried with preview three? If not, let me know and I will to see if some of the changes fixed the underlying issue. It would be good to get to the root cause, but if it's working with the next release... |
I'm working directly from the Preview 3 build and it's still there - unfortunately. I can reproduce the problem without any OpenAPI stuff. It's very strange that it only happens sometimes. Stranger still, I've noticed that adding the explicit route template (ex: |
Ultimately, this was a bug, which has now been fixed. It was the last hurdle I wanted to iron out before publishing Preview 3 with all the other changes and fixes. I've also gone through each route in the example to make sure it actually works. TL;DR The cause comes down to the combination of a few things. OData adds multiple The fix was simple that the API Versioning extensions for OData need to realize that if there is more than one EDM created and there are more than one selectors per action (e.g. I had actually forgotten and vaguely remembered that I had previously run into this issue. There was some code in place to handle it, but it was doing it wrong. There's some internal shuffling to put things in the right spot and optimize whether processing is even required. Fortunately, any work performed is fast and cheap. |
Preview 3 is now available and contains the fix for this issue. |
Thanks @commonsensesoftware!! |
Hi,
I'm not sure if you are seeing the same thing (and I don't suspect it is normal behavior) but when using the ODataOpenApiExample project, calling version v0.9 ~/api/Orders/1 returns a 404 and v1 ~/api/Orders/1 returns the order as expected. v2 and v3 both work as expected, but they each have their own controller.
On my own project, when using multiple versions on the same controller, one version will throw a 404 where the other returns the data - the same behavior. I should note in my case neither version is deprecated - thought that might be a clue but nope. I thought it may be due to the order, but changing it does not seem to make a difference either on the ODataOpenApiExample project or mine - which to be honest I found strange :) - it appears to always take the lowest whole number. So in my case I had v3 and v4, v3 would return data and v4 would return a 404.
Perhaps I am missing something or misunderstanding something somewhere?
The text was updated successfully, but these errors were encountered: