diff --git a/core/data/path.go b/core/data/path.go index 3460b7a..32cb0ba 100644 --- a/core/data/path.go +++ b/core/data/path.go @@ -24,6 +24,8 @@ func PathGetValue(value interface{}, path string) (interface{}, error) { newVal, newPath, err = pathGetSetObjValue(objVal, path, nil, false) } else if paramsVal, ok := value.(map[string]string); ok { newVal, newPath, err = pathGetSetParamsValue(paramsVal, path, nil, false) + } else if objVal, ok := value.(*ComplexObject); ok { + return PathGetValue(objVal.Value, path) } else { return nil, fmt.Errorf("unable to evaluate path: %s", path) } @@ -32,6 +34,8 @@ func PathGetValue(value interface{}, path string) (interface{}, error) { newVal, newPath, err = pathGetSetMapValue(objVal, path, nil, false) } else if paramsVal, ok := value.(map[string]string); ok { newVal, newPath, err = pathGetSetMapParamsValue(paramsVal, path, nil, false) + } else if objVal, ok := value.(*ComplexObject); ok { + return PathGetValue(objVal.Value, path) } else { return nil, fmt.Errorf("unable to evaluate path: %s", path) } @@ -62,6 +66,8 @@ func PathSetValue(attrValue interface{}, path string, value interface{}) error { newVal, newPath, err = pathGetSetObjValue(objVal, path, value, true) } else if paramsVal, ok := attrValue.(map[string]string); ok { newVal, newPath, err = pathGetSetParamsValue(paramsVal, path, value, true) + } else if objVal, ok := value.(*ComplexObject); ok { + return PathSetValue(objVal.Value, path, value) } else { return fmt.Errorf("Unable to evaluate path: %s", path) } @@ -70,6 +76,8 @@ func PathSetValue(attrValue interface{}, path string, value interface{}) error { newVal, newPath, err = pathGetSetMapValue(objVal, path, value, true) } else if paramsVal, ok := attrValue.(map[string]string); ok { newVal, newPath, err = pathGetSetMapParamsValue(paramsVal, path, value, true) + } else if objVal, ok := value.(*ComplexObject); ok { + return PathSetValue(objVal.Value, path, value) } else { return fmt.Errorf("unable to evaluate path: %s", path) } diff --git a/core/data/scope.go b/core/data/scope.go index 5e248f5..dd369f6 100644 --- a/core/data/scope.go +++ b/core/data/scope.go @@ -203,7 +203,18 @@ func NewFixedScopeFromMap(metadata map[string]*Attribute) *FixedScope { func (s *FixedScope) GetAttr(name string) (attr *Attribute, exists bool) { attr, found := s.attrs[name] - return attr, found + + if found { + return attr, true + } else { + metaAttr, found := s.metadata[name] + if found { + attr, _ := NewAttribute(name, metaAttr.Type(), metaAttr.value) + s.attrs[name] = attr + return attr, true + } + } + return nil, false } // GetAttrs gets the attributes set in the scope