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

Function Example_replaceAnyAttribute

internal/patch/replace_test.go:9–31  ·  view source on GitHub ↗

The following example shows how to replace all values of one or more specific attributes.

()

Source from the content-addressed store, hash-verified

7
8// The following example shows how to replace all values of one or more specific attributes.
9func Example_replaceAnyAttribute() {
10 operation := `{
11 "op": "replace",
12 "value": {
13 "emails": [
14 {
15 "value": "quint",
16 "type": "work",
17 "primary": true
18 },
19 {
20 "value": "me@di-wu.be",
21 "type": "home"
22 }
23 ],
24 "nickname": "di-wu"
25 }
26}`
27 validator, _ := NewValidator(operation, schema.CoreUserSchema())
28 fmt.Println(validator.Validate())
29 // Output:
30 // map[emails:[map[primary:true type:work value:quint] map[type:home value:me@di-wu.be]] nickname:di-wu] <nil>
31}
32
33// The following example shows how to replace all of the members of a group with a different members list in a single
34// replace operation.

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…