Subject: [scim] PATCH Multi-Valued Attribute Value Type

From: Shelley <[email-masked]>
Date: Wed, 30 Sep 2020 16:22:22 -0500

For "add" and "replace" PATCH operations that specify multi-valued
attributes, is the content of the "*value*" attribute supposed to be an *array
*containing the new/replaced element(s) or a single *JSON object *containing
the new/replaced element? The RFC seems to contain examples for both, and I
would like to better understand the difference.

*Add Operation "Value" Type for Multi-Valued Attributes*
There is an "*add*" example on page 37 which specifies an *array *for a
multi-valued attribute:
{
  "op": "add",
  "path": "members",
  "value": *[*{
    "display": "Babs Jensen",
    "$ref": "https://example.com/v2/Users/2819c223...413861904646",
    "value": "2819c223-7f76-453a-919d-413861904646"
  }*]*
}

The description of "add", however, indicates that it contains "*a "value"
member whose content specifies the value to be added.*" In the case of
"add", the value being added is the individual element, not an array.

Also, the "add" description indicates that the "*value MAY be a quoted
value, or it may be a JSON object containing the sub-attributes*" but does *not
*seem to allow arrays (nor JSON literals, such as booleans or numbers,
which is a separate question...).

*Is the description or the example incorrect? Should the operation "value"
here be a JSON object or an array?*

*Replace Operation "Value" Type for Multi-Valued Attributes *
For "*replace*", there is an example on page 44 that specifies an *array *for
the "value" of a multi-valued attribute:
{
  "op": "replace",
  "path": "members",
  "value": *[*{
      "display": "Babs Jensen",
      "$ref": "https://example.com/v2/Users/2819c223...413861904646",
      "value": "2819c223...413861904646"
    },
    {
      "display": "James Smith",
      "$ref": "https://example.com/v2/Users/08e1d05d...473d93df9210",
      "value": "08e1d05d...473d93df9210"
    }
  *]*
}
However, there is also a "*replace*" example on page 45 that specifies
an *object
*(not an array) for the "value" of a multi-valued attribute:
{
  "op": "replace",
  "path": "addresses[type eq \"work\"]",
  "value": *{*
    "type": "work",
    "streetAddress": "911 Universal City Plaza",
    "locality": "Hollywood",
    "region": "CA",
    "postalCode": "91608",
    "country": "US",
    "formatted": "911 Universal City Plaza\nHollywood, CA 91608 US",
    "primary": true
  *}*
}

The use of the array for "replace" on "members" seems appropriate since it
is replacing the entire attribute with one or more values. For the
"addresses" value path, it's a little less clear to me. The use of an
object seems to imply that even if multiple addresses are matched by the
filter, only one new element may be specified to take it's/their place. Can
someone provide clarification on when to use *array vs. object *here?

Thank you!