validatePath tries to validate the path against the given schema.
(ref schema.Schema)
| 84 | |
| 85 | // validatePath tries to validate the path against the given schema. |
| 86 | func (v PathValidator) validatePath(ref schema.Schema) error { |
| 87 | // e.g. members |
| 88 | // ^______ |
| 89 | attr, err := validateAttributePath(ref, v.path.AttributePath) |
| 90 | if err != nil { |
| 91 | return err |
| 92 | } |
| 93 | |
| 94 | // e.g. members[value eq "0"] |
| 95 | // ^_____________ |
| 96 | if v.path.ValueExpression != nil { |
| 97 | if err := validateExpression( |
| 98 | schema.Schema{ |
| 99 | ID: ref.ID, |
| 100 | Attributes: MultiValuedFilterAttributes(attr), |
| 101 | }, |
| 102 | v.path.ValueExpression, |
| 103 | ); err != nil { |
| 104 | return err |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | // e.g. members[value eq "0"].displayName |
| 109 | // ^__________ |
| 110 | if subAttrName := v.path.SubAttributeName(); subAttrName != "" { |
| 111 | if err := validateSubAttribute(attr, subAttrName); err != nil { |
| 112 | return err |
| 113 | } |
| 114 | } |
| 115 | return nil |
| 116 | } |
no test coverage detected