Closed mokiat closed 3 years ago
Thank you for another comprehensive issue description! Both patch requests you listed should be valid, indeed. Maybe we can look into this sometime next week @di-wu?
Thank you for fixing this. I will give it a try these days.
If there is a Complex attribute that has multiple sub-attributes that are required, it is not possible to modify just one of those fields with a PATCH operation.
For example, let's consider a User schema where
givenName
andfamilyName
are required. Then the following queries fail:This is due to the following piece of code: https://github.com/elimity-com/scim/blob/7f9449eb6fe0b544af7a2e537c9bd30f9182c3ca/schema/core.go#L260-L279
The
found
variable is just used to check duplicates but does not handle when a field is missing. This might be correct for a PUT request, where you would expect both sub-attributes to be present, but for PATCH the specification states that it is ok to just modify one of the fields and the other should be left as is.Changing the code to the following solves the problem and both operations pass the validation:
However this probably breaks the validation for PUT, so likely a better approach is needed.