-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add sub-attribute to empty multi-valued attribute #42
Comments
Thanks, @arnecs to have open this issue, which will help me a lot to improve the library. |
I've looked at the RFC and it is unclear to me if your expected behavior is how SCIM is supposed to work.
Do you have any idea where this complex case refers to the RFC? BTW, even if we do not implement the feature, we should at least not failed in that case. |
Isn't this adding the new value to the resource? I agree that the RFC is a bit unclear in regards to using a filter in the path. |
The SCIM represantation Since the library has no knowledge of the schema definition it is impossible to know if the path specified in patch operation is in fact a multi-valued attribute. |
From 3.5.2.3 Replace Operation
If the filter is not matching any records it should not be treated as an add operation but respond with error "noTarget". |
So if I follow correctly in your case we should respond with a |
At least for the |
@arnecs I've done a fix for the I was looking more in detail on what you purpose for the const resource = { schemas: ["urn:ietf:params:scim:schemas:core:2.0:User"], addresses: [] }
const patches = [{ op: "Add", path: "addresses[type eq \"work\"].streetAddress", value: "1010 Broadway Ave"}] You expect to have this result: [
{
"type": "work",
"streetAddress": "1010 Broadway Ave"
}
] This case seems doable because you are using the filter const resource = { schemas: ["urn:ietf:params:scim:schemas:core:2.0:User"], addresses: [] }
const patches = [{ op: "Add", path: "addresses[type ne \"work\"].streetAddress", value: "1010 Broadway Ave"}] In that example we are using And I am not sure we can ignore the [ { "streetAddress": "1010 Broadway Ave" } ] because if you try to do the same thing again your filter will still not match the element you've added. |
Considering all different filters may be a problem. afaik, the RFC does not explicitly state what do in these cases. Discovered the issue when working with SCIM user provisioning from Azure AD. {"op":"Add","path":"addresses[type eq \"work\"].streetAddress","value":"1010 Broadway Ave"}]} |
If this is the way that Azure AD is working it's maybe worth to do it only for the add operation. I think this is a bit hacky but I think that being compatible with Azure AD is important. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I'm seeing this issue with Azure AD as well: {
"op": "Add",
"path": "addresses[type eq \"work\"].formatted",
"value": "1111 Street Rd"
} |
I’ll re-open the issue. |
@arnecs @maxdeviant I've opened a PR #106 to fix this problem. |
The version |
@thomaspoignant Thanks so much! |
Thank you for the fix! |
Describe the bug
Add/Replace a specific sub-attribute of a complex multi-valued attribute selected by "valuePath" filter is not working when current value if
undefined
/null
or an empty array[]
is provided.To Reproduce
When empty array is provided, another error occurs
Expected behavior
The new "streetAddress" and "type" should be added to the resource.
Expeced value for the addresses attribute is:
The text was updated successfully, but these errors were encountered: