// translateRemainingPaths translates remaining paths that are not available in existing mappings.
translateRemainingPaths translates remaining paths that are not available in existing mappings.
// translateRemainingPaths translates remaining paths that are not available in existing mappings .
func (t *ReverseTranslator) translateRemainingPaths(valueTree map[string]interface{},
	cpSpecTree map[string]interface{}, path util.Path) error {
	for key, val := range valueTree {
		newPath := append(path, key)
		if val == nil {
			continue
		}
		switch node := val.(type) {
		case map[string]interface{}:
			err := t.translateRemainingPaths(node, cpSpecTree, newPath)
			if err != nil {
				return err
			}
		case []interface{}:
			if err := tpath.WriteNode(cpSpecTree, util.ToYAMLPath("Values."+newPath.String()), node); err != nil {
				return err
			}
		default:
			if t.isEnablementPath(newPath) {
				continue
			}
			if err := tpath.WriteNode(cpSpecTree, util.ToYAMLPath("Values."+newPath.String()), val); err != nil {
				return err
			}
		}
	}
	return nil
}
func ( t * ReverseTranslator ) translateRemainingPaths ( valueTree map [ string ] interface { } , cpSpecTree map [ string ] interface { } , path util . Path ) error { for key , val := range valueTree { newPath := append ( path , key ) if val == nil { continue } switch node := val . ( type ) { case map [ string ] interface { } : err := t . translateRemainingPaths ( node , cpSpecTree , newPath ) if err != nil { return err } case [ ] interface { } : if err := tpath . WriteNode ( cpSpecTree , util . ToYAMLPath ( " " + newPath . String ( ) ) , node ) ; err != nil { return err } default : if t . isEnablementPath ( newPath ) { continue } if err := tpath . WriteNode ( cpSpecTree , util . ToYAMLPath ( " " + newPath . String ( ) ) , val ) ; err != nil { return err } } } return nil }
translateRemainingPaths translates remaining paths that are not available in existing mappings.
translateRemainingPaths translates remaining paths that are not available in existing mappings .
// value set to nil means no translation needed or being translated already. // remaining leaf need to be put into root.values