Replies: 1 comment
-
There was a bug that could allow dispatching to a versioned endpoint that was only mapped, but not declared. Without digging back through some commits, I don't remember exactly what version that was in. I think that would have shown up in the release notes 🤞🏽. It would have manifest as a fix not as a change in behavior. There are several possible options for a controller to be excluded from versioning: Option 1Mark the controller as API version-neutral. This likely aligns to your intent. A version-neutral API can match any defined API version, including none at all. That may negate the need to use
Option 2Remove Option 3You can replace the Let's say you add an attribute like so:
You could then have a filter like:
then you register in DI with:
If your controller is now decorated as:
it will not be subject to the constraints of API Versioning. |
Beta Was this translation helpful? Give feedback.
-
After we upgrading Asp.Versioning.OData and Asp.Versioning.OData.ApiExplorer from 6.0.0 to 8.0.0, we found that if we didn't specify api version in controller, 6.0.0 would allow any version to hit controller, but 8.0.0 would only allow default version.
We set default api version as 1.0.0:
This is a sample controller:
In 6.0.0, if I call it with ~/Get1?api-version=2.0 or any other versions, it will hit Get1 method.
In 8.0.0, if I call it with ~/Get1?api-version=2.0, it will return 400 bad request. Only ~/Get1?api-version=1.0 is allowed.
I didn't see this behavior is mentioned in release note.
What is your suggest to make the controller can handle any version? We have some proxy controllers, they don't care version.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions