Subject: [scim] Clarification on schemas handling in PATCH operations

From: Phil Hunt <[email-masked]>
Date: Sun, 6 Jul 2014 17:01:44 -0700

A question came up regarding handling of schemas attribute during PATCH operations. How is it specified/interpreted?

One difference between PATCH vs POST/PUT is that the body of the message is the actual object being manipulated. In contrast the body of the PATCH request has an api specific schema (that describes the attributes op, path, value, etc). For example:
{
  "schemas": ["urn:scim:api:messages:2.0:PatchOp"],
  "op":"add",
  "path":"members",
  "value":[
    {
      "display": "Babs Jensen",
      "$ref": "https://example.com/v2/Users/2819c223...413861904646",
      "value": "2819c223-7f76-453a-919d-413861904646"
    }
  ]
}
Thus how does a client indicate what schemas are in play for the data object being manipulated?

I propose the following clarification (added to the PATCH introduction section):
The attribute notation rules described in Section 3.8 apply for
describing attribute paths.  For all operations, the value of the
"schemas" attribute on the service provider's representation of the
resource SHALL be assumed by default.  If one of the PATCH operations
modifies the "schemas" attribute, subsequent operations SHALL assume
the modified state of the "schemas" attribute.  Clients MAY
implicitly modify the "schemas" attribute by adding (or replacing) an
attribute with its fully qualified name including schema URN.  For
example, adding the attribute
"urn:scim:schemas:extension:enterprise:2.0:User:employeeNumber",
automatically adds the value
"urn:scim:schemas:extension:enterprise:2.0:User" to the resource's
"schemas" attribute.
For example the following two PATCHes are equivalent.
Implicitly adding schema:
{
  "schemas": ["urn:scim:api:messages:2.0:PatchOp"],
  "op":"add",
  "path":"urn:scim:schemas:extension:enterprise:2.0:User:employeeNumber",
  "value”:”0987654321"
}
Or explicit schemas update and new attribute:
[
  {
    "schemas": ["urn:scim:api:messages:2.0:PatchOp”],
    "op":"add”,
    "path”:"schemas”,
    "value”:”urn:scim:schemas:extension:enterprise:2.0:User”
  },
  {
    "schemas": ["urn:scim:api:messages:2.0:PatchOp”],
    "op":"add”,
    "path":"employeeNumber”,
    "value”:”0987654321”
 }
]
Any objections/refinements to the above paragraph? I will add this (or some version close to it in the next draft.

Phil

@independentid
www.independentid.com
[email-masked]