Module patch

Module patch 

Source
Expand description

SCIM PATCH operations helper trait.

This module provides a reusable trait for implementing RFC 7644 compliant PATCH operations on SCIM resources. Any ResourceProvider can implement this trait to get full PATCH functionality without reimplementing the complex operation logic.

§RFC 7644 Compliance

This implementation follows RFC 7644 Section 3.5.2 (Modifying with PATCH) and supports:

  • add operations for adding attributes or values
  • remove operations for removing attributes or values
  • replace operations for replacing attribute values
  • Proper handling of multi-valued attributes
  • Readonly attribute protection
  • Complex attribute path parsing

§Usage

use serde_json::{json, Value};

// ScimPatchOperations provides RFC 7644 compliant PATCH operation handling:
// - add: Add new attributes or values
// - remove: Remove attributes or specific values
// - replace: Replace existing attributes or values
//
// Example PATCH operations:
let patch_ops = json!([
  {"op": "add", "path": "emails", "value": {"value": "new@example.com", "type": "work"}},
  {"op": "replace", "path": "active", "value": false},
  {"op": "remove", "path": "phoneNumbers[type eq \"fax\"]"}
]);
//
// When implemented by a ResourceProvider, automatically handles:
// - Complex attribute path parsing
// - Multi-valued attribute operations
// - Value filtering and selection

Traits§

ScimPatchOperations
Trait providing RFC 7644 compliant PATCH operations for SCIM resources.