AspNetCoreOData icon indicating copy to clipboard operation
AspNetCoreOData copied to clipboard

Odata decimal key 404 - EDM precision/scale settings not respected

Open houbi56 opened this issue 3 years ago • 12 comments

Using Aspnet core odata 8.0.6

http://localhost:5051/odata/wsdb/Jobbhist(261210.08) The value when entering the controller is 261210.1 and not the expected 261210.08. EDM-type of key is decimal (14,2), clr type is decimal This should work according to OData 4 spec.

http://localhost:5051/odata/wsdb/Jobbhist(261210.08M) <-- this works.

OData 4 spec: http://docs.oasis-open.org/odata/new-in-odata/v4.0/cn01/new-in-odata-v4.0-cn01.html#_Toc366145490 3.2.10 Pruned: URI Literal suffixes for numeric types Decimal, Double, Single, and Int64 literals in URIs no longer need to specify "M", "D", "F", or "L" suffixes when used in URIs

Might be related (but seems old..) OData/odata.net#461

houbi56 avatar Jan 26 '22 13:01 houbi56

Calling code: KeySegementTemplate.cs: 197 ODataUriUtils.ConvertFromUriLiteral(...)

houbi56 avatar Jan 26 '22 14:01 houbi56

Any updates on this? Seems like a rather serious bug!?

houbi56 avatar Feb 15 '22 12:02 houbi56

This bug seems to be in the AspnetCore OData not on OData lib. I have added a test to confirm this is working well in ODL path parser OData/odata.net#2325

KenitoInc avatar Feb 18 '22 08:02 KenitoInc

Related https://github.com/OData/odata.net/issues/461

ElizabethOkerio avatar Feb 18 '22 09:02 ElizabethOkerio

"Mutilated" seems very misleading for the described scenario. Can you rename the issue to "rounded" perhaps @houbi56 ?

Or even better, something like "decimal parsing not respecting EDM precision/scale settings" or something like that.

julealgon avatar Feb 18 '22 15:02 julealgon

Any updates?

houbi56 avatar Apr 07 '22 07:04 houbi56

@KenitoInc Could the errand be reassigned or re-triaged? We're still affected by this bug.

houbi56 avatar Apr 26 '22 08:04 houbi56

@houbi56 We made some fixes in the EdmLib https://github.com/OData/odata.net/pull/2346 We have an open PR that we will be merging soon https://github.com/OData/WebApi/pull/2420 Once we merge PR 2420, we will port that to this repo. Hopefully that will fix your issue

KenitoInc avatar Apr 26 '22 09:04 KenitoInc

@KenitoInc Great! Thanks for the feedback.

houbi56 avatar Apr 27 '22 07:04 houbi56

I see that the changes are merged. Is there an issue to track for the port to this repo?

houbi56 avatar Jun 08 '22 16:06 houbi56

@houbi56 We made some fixes in the EdmLib OData/odata.net#2346 We have an open PR that we will be merging soon OData/WebApi#2420 Once we merge PR 2420, we will port that to this repo. Hopefully that will fix your issue

Tested with AspNetCore.OData 8.1.1 and Microsoft.OData.Core 7.15 and issue still persist. Could we perhaps get some eyes on this? @KenitoInc

houbi56 avatar Apr 06 '23 15:04 houbi56

Tested with AspNetCore.OData 8.2.4 and Microsoft.OData.Core 7.2.0 and issue still persist. Could we perhaps get some eyes on this? @KenitoInc @ElizabethOkerio @xuzhg

It's been 2 years! I see performance fixes prioritized before bug fixes. Since this issue is already fixed in WebApi repo, could we please get this prioritized?

houbi56 avatar Jan 22 '24 08:01 houbi56