Skip to content

fix: itemsPerPage should reflect the number of resources returned (#208)#210

Open
CedricConday wants to merge 1 commit into
15five:mainfrom
CedricConday:fix/itemsperpage-returned-count
Open

fix: itemsPerPage should reflect the number of resources returned (#208)#210
CedricConday wants to merge 1 commit into
15five:mainfrom
CedricConday:fix/itemsperpage-returned-count

Conversation

@CedricConday

Copy link
Copy Markdown

What

ListResponse.itemsPerPage is returned as the requested page size (count) instead of the number of resources actually returned.

Per SCIM RFC 7644 §3.4.2, itemsPerPage is "the number of resources returned in a list response page." The current behavior is misleading whenever the requested count exceeds the available results:

  • GET /Users?startIndex=1&count=100 against 25 users → itemsPerPage: 100 (only 25 returned)
  • GET /Users?startIndex=101&count=100itemsPerPage: 100 with Resources: []

Fixes #208.

Fix

- 'itemsPerPage': count,
+ 'itemsPerPage': len(resources),

in FilterMixin._build_response.

Tests

  • Added a regression test covering both reported cases (count > available → itemsPerPage == 2; startIndex beyond the result set → itemsPerPage == 0).
  • Several existing tests asserted the pre-fix value (itemsPerPage equal to the requested count, e.g. 50/5, regardless of how many resources were returned). These were corrected to the actual page size (their totalResults, since each fit on a single page).

Full suite: 77 passed, 7 skipped.

Closes #208

…five#208)

ListResponse.itemsPerPage was set to the requested `count` rather than the
number of resources actually returned. Per SCIM RFC 7644, itemsPerPage is the
number of resources in the current page, so a request with count=100 against
25 users (or a startIndex past the end) reported a misleading page size.

Set itemsPerPage to len(resources).

Several existing tests asserted the pre-fix value (itemsPerPage equal to the
requested count); corrected them to the actual page size and added a regression
test covering count > available and startIndex beyond the result set.

Closes 15five#208
@fifteen5-Security

fifteen5-Security commented Jun 29, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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.

ListResponse itemsPerPage should reflect returned Resources count, not requested count

2 participants