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 #176 - allow adds when there is no matching target in an array #177

Merged

Conversation

barryhagan
Copy link
Contributor

Description

Fix to allow PATCH operations to add values to multi-valued attributes when using a path filter.

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • New feature (non-breaking change that adds functionality)
  • [?] Breaking changes (change that is not backward-comptible and/or changes current functionality)

There are two tests that were changed to expect a NoTarget exception instead of InvalidScimPatchOp. I'm not sure if you consider that throw behavior change breaking.

Closes issue(s)

Resolve #176

Checklist

  • I have tested this code
  • I have added unit test to cover this code
  • I have updated the Readme
  • I have followed the contributing guide

@sonarcloud
Copy link

sonarcloud bot commented Jan 20, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Owner

@thomaspoignant thomaspoignant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @barryhagan,
Thank you for your contribution this is super great.
I will release a new version v0.5.7 Today with this fix.

@@ -241,7 +241,7 @@ function applyAddOrReplaceOperation<T extends ScimResource>(scimResource: T, pat
// code 400 and a "scimType" error code of "noTarget".
const isReplace = patch.op.toLowerCase() === 'replace';
if (isReplace && matchFilter.length === 0) {
throw new NoTarget(patch.value);
throw new NoTarget(patch.path);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thank you 👌

@thomaspoignant thomaspoignant merged commit 056a493 into thomaspoignant:master Jan 21, 2022
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.

Cannot add new entry to multi-valued attribute using a path filter
2 participants