OData / odata.net

ODataLib: Open Data Protocol - .NET Libraries and Frameworks
https://docs.microsoft.com/odata
Other
686 stars 349 forks source link

Invalid UriOperationParameter serialization. #1189

Open VirusQuartirus opened 6 years ago

VirusQuartirus commented 6 years ago

When using complex type (CT) value in UriOperationParameter ODataLib doesn't serialize nested CT properties. Only primitive type property values appear in request URI.

Assemblies affected

OData .Net lib 7.4

Reproduce steps

Invoke DataServiceContext.ExecuteAsync() with UriOperationParameter that contain CT object with some properties of other CT.

Expected result

Request URI contains fully serialized CT object.

Actual result

URI contains only primitive type properties been serialized. Nested CT properties are ignored.

mikepizzo commented 6 years ago

This looks to be a problem in the DataServiceClient serializer.

ConvertToEscapedUriValue calls ConvertToODataValue to get a single ODataResource, which is then passed to ODataUriUtils.ConvertToUriLiteral to get the string to serialize as the parameter value.

There is no code for writing nested complex types. This would entail new code that walked through complex typed properties (and collections of complex typed properties), creating corresponding ODataResources and ODataResourceSets for each, and then calling code similar to ConvertToUriEntityLiteral that looped through the (collections of) complex typed properties and wrote nested resources for each.

VirusQuartirus commented 6 years ago

But in ODataLib 6.x this functionality worked fine. Why it's broken now?