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 checks of startIndex and itemsPerPage in ListResponse #46

Merged
merged 2 commits into from
Sep 6, 2024

Conversation

sleelin
Copy link
Collaborator

@sleelin sleelin commented Sep 5, 2024

Currently on instantiation, the ListResponse class will check that the startIndex and itemsPerPage properties are integer values greater than or equal to 1 and 0 respectively, and throw a TypeError if not. This was intended to prevent the use of invalid values in bespoke implementations. According to RFC7644, startIndex and itemsPerPage values less than this should be treated as being 1 and 0 respectively. This rounding is already implemented in the ListResponse constructor, but is functionally unused, as the constructor will throw the TypeError first.

This change removes the minimum integer value check from the ListResponse constructor (fixes #42), and rounds startIndex and count integer constraints to their minimum values in the SCIMMY.Types.Resource constructor. Test fixtures have also been updated to reflect this change, and will now check for more non-number values in place of non-positive integers.

@sleelin sleelin linked an issue Sep 5, 2024 that may be closed by this pull request
@sleelin sleelin self-assigned this Sep 5, 2024
@sleelin sleelin added the bug Something isn't working label Sep 5, 2024
@sleelin sleelin added this to the 1.2.4 milestone Sep 5, 2024
@sleelin sleelin merged commit 863a1eb into main Sep 6, 2024
3 checks passed
@sleelin sleelin deleted the issue/42-invalid-startindex branch September 6, 2024 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

Invalid values of startIndex lead to errors
1 participant