Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for bad ordering with $skiptoken enabled and $orderby=... desc #1054

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

orty
Copy link
Contributor

@orty orty commented Sep 15, 2023

Hi,

We just encountered an issue related to the EnableLowerCamelCase feature, in a scenario where we issue a query with pagination enabled (using $skiptoken) and a descending $orderby.

The issue is situated here :

if (directionMap.ContainsKey(key) && directionMap[key] == OrderByDirection.Descending)

the keys in the dictionary do not match with the key variable because of the different casing. The same is happening with aliased properties.
It results in a false 'false' evaluation of the if condition, and the else branch of the if is evaluated, generating a wrong predicate on SQL side (ascending instead of descending)

The issue can be fixed here :

orderByNodes.OfType<OrderByPropertyNode>().ToDictionary(node => node.Property.Name, node => node.Direction);

by providing the proper keys to the directionMap dictionary.

…` when declaring an Edm model with lowercased or aliased properties
@gathogojr gathogojr merged commit 3e52f81 into OData:main Sep 25, 2023
2 checks passed
@orty orty deleted the fix-skiptoken-ordering-desc branch September 25, 2023 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants