validateSubAttribute checks whether the given attribute name is a attribute within the given reference attribute.
(attr schema.CoreAttribute, subAttrName string)
| 72 | |
| 73 | // validateSubAttribute checks whether the given attribute name is a attribute within the given reference attribute. |
| 74 | func validateSubAttribute(attr schema.CoreAttribute, subAttrName string) error { |
| 75 | if !attr.HasSubAttributes() { |
| 76 | return fmt.Errorf("the attribute has no sub-attributes") |
| 77 | } |
| 78 | |
| 79 | if _, ok := attr.SubAttributes().ContainsAttribute(subAttrName); !ok { |
| 80 | return fmt.Errorf("the attribute has no sub-attributes named: %s", subAttrName) |
| 81 | } |
| 82 | return nil |
| 83 | } |
| 84 | |
| 85 | // Validator represents a filter validator. |
| 86 | type Validator struct { |
no test coverage detected
searching dependent graphs…