pub fn reject_read_only_patch<O: SetObject>(
patch: &Map<String, Value>,
current: Option<&Map<String, Value>>,
) -> Option<SetError>Expand description
Reject a /set update patch that names a server-set or immutable
property of O.
A patch key names a property when it equals the property name or starts
with "<name>/", a JSON Pointer inside it (RFC 8620 §5.3). Changing a
SetObject::SERVER_SET property is invalidProperties (RFC 8620
§5.3), and a SetObject::IMMUTABLE value “MUST NOT change after the
object is created” (RFC 8620 §1.1).
current is the stored object, when the handler has it. RFC 8620 §5.3:
“Any server-set properties MAY be included in the patch if their value is
identical to the current server value”, so a key that names the whole
property with its stored value passes. A key with further segments always
changes the property and is rejected.
Returns None when the patch names none. Otherwise returns an
invalidProperties SetError whose properties lists each property
named, SERVER_SET first, then IMMUTABLE, each in list order.
ponytail: compares the raw first segment, without RFC 6901 ~0/~1
decoding, which is exact for property names with no ~ or /. With
current None an unchanged value is rejected too; a handler that can
fetch the stored object passes it.