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

Method getRefSubAttribute

internal/patch/patch.go:155–170  ·  view source on GitHub ↗

getRefSubAttribute returns the sub-attribute of the reference attribute that matches the given subAttrName, if none are found it will return an error.

(refAttr *schema.CoreAttribute, subAttrName string)

Source from the content-addressed store, hash-verified

153// getRefSubAttribute returns the sub-attribute of the reference attribute that matches the given subAttrName, if none
154// are found it will return an error.
155func (v OperationValidator) getRefSubAttribute(refAttr *schema.CoreAttribute, subAttrName string) (*schema.CoreAttribute, error) {
156 if !refAttr.HasSubAttributes() {
157 return nil, fmt.Errorf("the referred attribute has no sub-attributes: %s", v.Path)
158 }
159 var refSubAttr *schema.CoreAttribute
160 for _, attr := range refAttr.SubAttributes() {
161 if strings.EqualFold(attr.Name(), subAttrName) {
162 refSubAttr = &attr
163 break
164 }
165 }
166 if refSubAttr == nil {
167 return nil, fmt.Errorf("could not find attribute %s", v.Path)
168 }
169 return refSubAttr, nil
170}
171
172// validateEmptyPath validates paths that don't have a "path" value. In this case the target location is assumed to be
173// the resource itself. The "value" parameter contains a set of attributes to be added to the resource.

Callers 4

getRefAttributeMethod · 0.95
validateUpdateMethod · 0.95
validateRemoveMethod · 0.95

Calls 3

HasSubAttributesMethod · 0.80
SubAttributesMethod · 0.80
NameMethod · 0.80