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 exception handling in PatchOp's replace operation #20

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

sleelin
Copy link
Collaborator

@sleelin sleelin commented Apr 9, 2024

Previously, PatchOp's internal replace operation handling method would rethrow any exceptions thrown when attempting to remove a value before re-adding it, provided it didn't have a scimType of noTarget. This meant that required attribute values could not be replaced, as the call to remove the required attribute's value threw an exception with a scimType of invalidValue, despite having the value immediately added back.

Ultimately, all exceptions thrown in the removal phase of the replace operation can safely be discarded, as the subsequent call to re-add the value will perform its own constraint validation, thereby throwing the same relevant exception thrown in the removal phase (fixes #16).

The test fixtures for the PatchOp message class have also been updated to check that replace operations for required attributes behaves as expected.

@sleelin sleelin added the bug Something isn't working label Apr 9, 2024
@sleelin sleelin added this to the 1.1.0 milestone Apr 9, 2024
@sleelin sleelin self-assigned this Apr 9, 2024
@sleelin sleelin linked an issue Apr 9, 2024 that may be closed by this pull request
@sleelin sleelin merged commit c8668f8 into main Apr 15, 2024
3 checks passed
@sleelin sleelin deleted the issue/16-replace-patch-operation-required-attributes branch April 15, 2024 08:37
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.

Replace Patch Operation fails for required properties.
1 participant