fix: itemsPerPage should reflect the number of resources returned (#208)#210
Open
CedricConday wants to merge 1 commit into
Open
fix: itemsPerPage should reflect the number of resources returned (#208)#210CedricConday wants to merge 1 commit into
CedricConday wants to merge 1 commit into
Conversation
…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
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
ListResponse.itemsPerPageis returned as the requested page size (count) instead of the number of resources actually returned.Per SCIM RFC 7644 §3.4.2,
itemsPerPageis "the number of resources returned in a list response page." The current behavior is misleading whenever the requestedcountexceeds the available results:GET /Users?startIndex=1&count=100against 25 users →itemsPerPage: 100(only 25 returned)GET /Users?startIndex=101&count=100→itemsPerPage: 100withResources: []Fixes #208.
Fix
in
FilterMixin._build_response.Tests
itemsPerPage == 2;startIndexbeyond the result set →itemsPerPage == 0).itemsPerPageequal to the requestedcount, e.g.50/5, regardless of how many resources were returned). These were corrected to the actual page size (theirtotalResults, since each fit on a single page).Full suite: 77 passed, 7 skipped.
Closes #208