Validate validates the PATCH operation. Unknown attributes in complex values are ignored. The returned interface contains a (sanitised) version of given value based on the attribute it targets. Multi-valued attributes will always be returned wrapped in a slice, even if it is just one value that was
()
| 99 | // contains a (sanitised) version of given value based on the attribute it targets. Multi-valued attributes will always |
| 100 | // be returned wrapped in a slice, even if it is just one value that was defined within the operation. |
| 101 | func (v OperationValidator) Validate() (interface{}, error) { |
| 102 | switch v.Op { |
| 103 | case OperationAdd, OperationReplace: |
| 104 | return v.validateUpdate() |
| 105 | case OperationRemove: |
| 106 | return v.validateRemove() |
| 107 | default: |
| 108 | return nil, fmt.Errorf("invalid operation Op: %s", v.Op) |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | // getRefAttribute returns the corresponding attribute based on the given attribute path. |
| 113 | // |
no test coverage detected