Added support for single element pages#4
Added support for single element pages#4langecode merged 20 commits intoopenapi-tools:masteropenapi-tools/api-capabilities:masterfrom
Conversation
To reflect the actual implementation regarding Sort.
Codecov Report
@@ Coverage Diff @@
## master #4 +/- ##
============================================
+ Coverage 89.74% 90.51% +0.77%
- Complexity 105 106 +1
============================================
Files 10 10
Lines 234 232 -2
Branches 35 35
============================================
Hits 210 210
+ Misses 8 6 -2
Partials 16 16
Continue to review full report at Codecov.
|
|
Sounds reasonable. I will take a look and possibly merge this week. |
| if (null == element) { | ||
| return Optional.empty(); | ||
| } | ||
| if (!element.matches("^([0-9]+)?(\\|[0-9]+)?")) { |
There was a problem hiding this comment.
Wonder if the syntax of selecting just one element would most naturally be 1|1 or just 1 - it seems for some reason originally both the first part and the last part was optional. If the last part was kept optional you could still allow for a selection in its most simple form 1
There was a problem hiding this comment.
I adjusted the code to allow both single element, and same start and end element.
|
Looks good - but I do believe that maybe it should be allowed to leave out the |
# Conflicts: # src/main/java/io/openapitools/api/capabilities/Element.java
Done. Updated the readme to reflect this. |
|
Thanks 👍 |
|
Hi @langecode. Are you planning a new release with the merged changes? |
|
Indeed this is released as 1.0.4 |
Changes:
Since both from and to is inclusive, as stated in the readme, it should be a valid input to be able to say 1|1, for example if you only want the first element of a list, or if you're generating links for the previous/next page and you end up having the last page only one element long.