Skip to content

Commit e0c5faa

Browse files
refactor: Clarify RNode serialization approach
RNode doesn't provide direct conversion to map[string]interface{}. The serialize-unmarshal approach is standard in the kpt codebase. Signed-off-by: Surbhi <agarwalsurbhi1807@gmail.com>
1 parent 54e433a commit e0c5faa

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

internal/fnruntime/celeval.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ func (e *CELEvaluator) resourcesToList(resources []*yaml.RNode) ([]interface{},
116116
}
117117

118118
// resourceToMap converts a single RNode to a map for CEL evaluation
119-
// Note: We serialize to string then unmarshal because RNode's internal YNode structure
120-
// is not directly compatible with CEL's type system. While this has a memory cost,
121-
// it ensures correct CEL evaluation of nested fields and complex structures.
119+
// RNode doesn't provide a direct method to convert to map[string]interface{},
120+
// so we serialize to YAML string and unmarshal back. This is the standard approach
121+
// used throughout the kpt codebase for converting RNode to generic maps.
122122
func (e *CELEvaluator) resourceToMap(resource *yaml.RNode) (map[string]interface{}, error) {
123123
yamlStr, err := resource.String()
124124
if err != nil {

0 commit comments

Comments
 (0)