aspnet-api-versioning icon indicating copy to clipboard operation
aspnet-api-versioning copied to clipboard

Issue with complex object as Action param with odata versioning

Open pashokchakravarthi opened this issue 4 years ago • 2 comments
trafficstars

We are using Microsoft.AspNetCore.OData (v7.4.0) with AspNet Core Rest API's. The endpoints enabled with OData has Complex type object as parameter - which is working fine. Now we are trying to add api versioning support to our api's, using the latest Microsoft.AspNetCore.OData.Versioning package v5.0.0.0 - Facing issue described below. When complex type object param is removed, everything seems to be working fine.

Able to recreate the issue with sample project AdvancedODataSample available in this repo. image

Issue: image

pashokchakravarthi avatar Dec 07 '20 17:12 pashokchakravarthi

Sorry for the long overdue follow up to this question. I'm pretty sure that this is actually the same problem as in #711. I'll have to dig in deeper, but it seems that optional and complex query parameters are not matched. There's probably some update to the OData routing from the code I had to fork that is resulting in a miss. Hopefully, the solution will address both problems.

commonsensesoftware avatar Jun 24 '21 07:06 commonsensesoftware

Last call. Did you ever find a solution? Are you still using OData 7.x? API Versioning 6.0 has been released with support for OData 8.x. The OData team fixed many of the routing issues and API Versioning doesn't need to get nearly as involved with duplicating or changes things like it used to. If you're stuck on OData 7.x, then I need to reprioritize this work for a patch release.

commonsensesoftware avatar Aug 24 '22 01:08 commonsensesoftware

I'm sure this was probably an issue at some point. Based on the way routing works in OData 7.x, it's quite likely a 🐞 in the 5.x flavor of API Versioning. I can confirm that this is a non-issue with API Versioning 6.0+ and OData 8.x+.

I made the same changes you made in the advanced OData example with this request:

https://localhost:5001/api/orders/1?api-version=2.0&tstModel.Id=42&tstModel.Name=Test

And the result is:

image

Model binding is working as expected.

Since this thread has also gone idle, I'm going to close it out. If you happen to see something resurface in 6.0+, I'm happy to investigate or reopen the issue. Thanks.

commonsensesoftware avatar Sep 29 '22 02:09 commonsensesoftware