SAP / open-ux-odata

Enable community collaboration to jointly promote and facilitate best in class framework and tooling capabilities when working with OData services.
Apache License 2.0
51 stars 10 forks source link

BUG - $orderBy a nullable numeric field does not sort properly #851

Open junweiworks opened 1 week ago

junweiworks commented 1 week ago

Related Feature

Mock server

Description

We want to make an OData request like so: abc.xyz/odata/v4/Service.svc/Entity?$orderby=nullableNumericField. nullableNumericField is a numeric field that may be null. The mock server regards 0 and null as the same value, thus when sorted entities with these 2 values are mixed together (while other entities with other numeric values are sorted properly). To illustrate, this is a potential response:

[
  {
    "nullableNumericField": null
  },
  {
    "nullableNumericField": 0
  },
  {
    "nullableNumericField": null
  },
  {
    "nullableNumericField": 1
  },
  {
    "nullableNumericField": 2
  },
  {
    "nullableNumericField": 3
  }
]

We have tested this query with our actual backend service (a CAP microservice) and the sorting worked fine.

Expected results

null should be sorted before 0

Actual results

See above