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

Inconsistency in Fluent API Order: Query Composition Bug in URL Generation #32

Open
onurkanbakirci opened this issue Jan 31, 2024 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@onurkanbakirci
Copy link
Contributor

I have identified an inconsistency when composing queries for URL generation. In my TypeScript code, I observed that the order of the expand and select functions affects the resulting URL, which I believe is unintended behavior.

When I use the following code snippet:

             .expand(
                t => t.class,
                q =>
                  q.select(
                    s => s.id,
                    s => s.name
                  )
              )
              .select(
                t => s.id,
                t => s.firstName,
                t => s.lastName
              )
              .toString()

I obtain the URL: http://localhost:5226/api/v1/teachers?$select=id,firstName,lastName

However, when I switch the order of the functions:

             .select(
                t => s.id,
                t => s.firstName,
                t => s.lastName
              )
             .expand(
                t => t.class,
                q =>
                  q.select(
                    s => s.id,
                    s => s.name
                  )
              )
              .toString()

I get the desired URL: http://localhost:5226/api/v1/teachers?$expand=class($select=id,name)&$select=id,firstName,lastName

This discrepancy suggests that the order of the operations should not affect the result, and I believe this behavior may be a bug. Consistent results should be returned regardless of the order in which expand and select functions are applied.

@rosostolato rosostolato added bug Something isn't working good first issue Good for newcomers labels Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants