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

Method validatePath

internal/filter/path.go:86–116  ·  view source on GitHub ↗

validatePath tries to validate the path against the given schema.

(ref schema.Schema)

Source from the content-addressed store, hash-verified

84
85// validatePath tries to validate the path against the given schema.
86func (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}

Callers 1

ValidateMethod · 0.95

Calls 4

validateAttributePathFunction · 0.85
validateExpressionFunction · 0.85
validateSubAttributeFunction · 0.85

Tested by

no test coverage detected