The following example shows how to replace all of the members of a group with a different members list in a single replace operation.
()
| 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. |
| 35 | func Example_replaceMembers() { |
| 36 | operations := []string{`{ |
| 37 | "op": "replace", |
| 38 | "path": "members", |
| 39 | "value": [ |
| 40 | { |
| 41 | "display": "di-wu", |
| 42 | "$ref": "https://example.com/v2/Users/0001", |
| 43 | "value": "0001" |
| 44 | }, |
| 45 | { |
| 46 | "display": "example", |
| 47 | "$ref": "https://example.com/v2/Users/0002", |
| 48 | "value": "0002" |
| 49 | } |
| 50 | ] |
| 51 | }`, |
| 52 | } |
| 53 | for _, op := range operations { |
| 54 | validator, _ := NewValidator(op, schema.CoreGroupSchema()) |
| 55 | fmt.Println(validator.Validate()) |
| 56 | } |
| 57 | // Output: |
| 58 | // [map[$ref:https://example.com/v2/Users/0001 display:di-wu value:0001] map[$ref:https://example.com/v2/Users/0002 display:example value:0002]] <nil> |
| 59 | } |
| 60 | |
| 61 | // The following example shows how to change a specific sub-attribute "streetAddress" of complex attribute "emails" |
| 62 | // selected by a "valuePath" filter. |
nothing calls this directly
no test coverage detected
searching dependent graphs…