Package org.mockserver.scim
Class ScimPatchApplier
java.lang.Object
org.mockserver.scim.ScimPatchApplier
Applies a SCIM 2.0
PatchOp (urn:ietf:params:scim:api:messages:2.0:PatchOp) to a
stored resource. Supports the three operations — add, replace, remove —
over a deliberately small path grammar: a top-level attribute (emails) or a one-level
sub-attribute (name.familyName).
Semantics:
replacewith a path — set the attribute to the supplied value.replacewithout a path — shallow-merge the supplied value object into the resource.addwith a path — set a scalar/object, or append to an array attribute (e.g.emails,members).addwithout a path — shallow-merge the supplied value object.removewith a path — delete the attribute (or sub-attribute).
The SCIM-managed reserved attributes id, meta and schemas are
readOnly (RFC 7644 §3.5.2). PatchOps that target them — whether by an explicit
path (e.g. "path":"meta") or by a no-path merge — are silently ignored as
no-ops so a client cannot overwrite the SCIM envelope or the server-managed metadata on the
stored copy. Ignoring (rather than returning a 400 mutability error) keeps the mock
non-breaking and consistent across add/replace/remove.
A malformed PatchOp throws ScimPatchApplier.ScimPatchException carrying the invalidSyntax
SCIM error keyword so the caller can emit a 400 error envelope.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSignals a malformed PatchOp; carries the SCIMscimTypekeyword. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.jackson.databind.node.ObjectNodeapply(com.fasterxml.jackson.databind.node.ObjectNode resource, com.fasterxml.jackson.databind.node.ObjectNode patchOp) Applies the patch document to a copy of the resource and returns the patched copy.
-
Constructor Details
-
ScimPatchApplier
public ScimPatchApplier()
-
-
Method Details
-
apply
public com.fasterxml.jackson.databind.node.ObjectNode apply(com.fasterxml.jackson.databind.node.ObjectNode resource, com.fasterxml.jackson.databind.node.ObjectNode patchOp) Applies the patch document to a copy of the resource and returns the patched copy.- Parameters:
resource- the stored resource (not mutated)patchOp- the PatchOp document- Throws:
ScimPatchApplier.ScimPatchException- if the document is malformed
-