MCPcopy Create free account
hub / github.com/elimity-com/scim / Example_replaceWorkAddress

Function Example_replaceWorkAddress

internal/patch/replace_test.go:76–93  ·  view source on GitHub ↗

The following example shows how to change a User's entire "work" address, using a "valuePath" filter.

()

Source from the content-addressed store, hash-verified

74
75// The following example shows how to change a User's entire "work" address, using a "valuePath" filter.
76func Example_replaceWorkAddress() {
77 operation := `{
78 "op": "replace",
79 "path": "addresses[type eq \"work\"]",
80 "value": {
81 "type": "work",
82 "streetAddress": "ExampleStreet 1",
83 "locality": "ExampleCity",
84 "postalCode": "0001",
85 "country": "BE",
86 "primary": true
87 }
88}`
89 validator, _ := NewValidator(operation, schema.CoreUserSchema())
90 fmt.Println(validator.Validate())
91 // Output:
92 // [map[country:BE locality:ExampleCity postalCode:0001 primary:true streetAddress:ExampleStreet 1 type:work]] <nil>
93}

Callers

nothing calls this directly

Calls 3

ValidateMethod · 0.95
CoreUserSchemaFunction · 0.92
NewValidatorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…