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

Response pageCount is incorrect #1813

Closed
1 task done
tbnguyen1407 opened this issue May 17, 2023 · 3 comments · Fixed by #1829
Closed
1 task done

Response pageCount is incorrect #1813

tbnguyen1407 opened this issue May 17, 2023 · 3 comments · Fixed by #1829
Labels
bug Something isn't working general

Comments

@tbnguyen1407
Copy link

tbnguyen1407 commented May 17, 2023

Which version are you using?

v0.23.0

Which operating system are you using?

  • Windows amd64 standard

Describe the issue

Page count is incorrect when itemsPerPage is smaller or equal to total number of items

Describe how to replicate the issue

  1. start the server
  2. add 3 paths
  3. call /v1/paths/list?itemsPerPage=X
    • X=1 -> pageCount=4 ## wrong, should be 3
    • X=2 -> pageCount=2 ## right
    • X=3 -> pageCount=2 ## wrong, should be 1
    • X=4 -> pageCount=1 ## right
    • X>=4 -> pageCount=1 ## right

Did you attach the server logs?

no

Did you attach a network dump?

no

Notes

For pagination it is more common to return total item count instead of total page count and let the client side figure out the total page count. It is currently not possible to know how many paths there are in total.

Client side needs:

  • Page index (from request/response)
  • Page size (from request/response)
  • Total item count (from response)

Common practice is to return pagination in response header, e.g.:

X-Pagination-Page-Index
X-Pagination-Page-Size
X-Pagination-Total-Count  ## item count not page count
@aler9
Copy link
Member

aler9 commented May 18, 2023

Hello @tbnguyen1407 , thanks for reporting the two issues. I fixed the pageCount issue and added the itemCount field.

@aler9
Copy link
Member

aler9 commented May 18, 2023

Fixed in in v0.23.1

Copy link
Contributor

This issue is being locked automatically because it has been closed for more than 6 months.
Please open a new issue in case you encounter a similar problem.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working general
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants