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 unclear spec doc for the OrderBy keyword #577

Merged
merged 2 commits into from
Mar 22, 2024

Conversation

njr-11
Copy link
Contributor

@njr-11 njr-11 commented Mar 21, 2024

This aims to at least partially fix unclear specification language identified in #576 around the OrderBy keyword.

@njr-11 njr-11 added bug Something isn't working documentation Improvements or additions to documentation labels Mar 21, 2024
@njr-11 njr-11 added this to the Jakarta Data 1.0 milestone Mar 21, 2024
@@ -934,7 +934,7 @@ The parsing of query method names follows a specific format:
- The method name consists of the subject, the predicate, and optionally the order clause.
- The subject begins with the action (such as `find` or `delete`) and is optionally followed by an expression (for example, `First10`), followed by any number of other characters, followed by `By`.
- The predicate defines the query's condition or filtering criteria, where multiple conditions are delimited by `And` or `Or`. For example, `PriceLessThanAndNameLike`.
- The order clause, which is optional, begins with `OrderBy` and consists of an ordered collection of entity attributes by which to sort results, delimited by `Asc` or `Desc` to specify the sort direction of the preceding attribute.
- The order clause, which is optional, begins with `OrderBy` and is followed by one or more ordered pairings consisting of entity attribute name and direction of sorting (`Asc` or `Desc`). For example, `OrderByPriceDescIdAsc`. Ordering of results is performed by sorting the first entity attribute according to its respective direction, where results that sort to the same position are subsequently sorted by the second entity attribute according to its respective direction, and so forth.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But, when we don't put Asc it is asc implicitly.

It also happens in SQL, and we share the same behavior in NoSQL:

SELECT * FROM Products ORDER BY Price;

It would be great if you reproduce it here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. The BNF does allow an optimization where the direction can be omitted on the final property and we need to define the meaning of that in the spec. I added commit 487098a to address this.

@njr-11 njr-11 force-pushed the fix-unclear-doc-of-orderby-keyword branch from b5cce71 to 487098a Compare March 22, 2024 14:36
@otaviojava otaviojava merged commit 2ed8da7 into jakartaee:main Mar 22, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants