Skip to content

Commit

Permalink
fix attribute access for nested dict/dataclass
Browse files Browse the repository at this point in the history
Signed-off-by: Future-Outlier <[email protected]>
  • Loading branch information
Future-Outlier committed Aug 8, 2024
1 parent 1dcfbc4 commit d5d7b79
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions flytepropeller/pkg/controller/nodes/attr_path_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,20 @@ func convertInterfaceToLiteral(nodeID string, obj interface{}) (*core.Literal, e

switch obj := obj.(type) {
case map[string]interface{}:
newSt, err := structpb.NewStruct(obj)
jsonBytes, err := json.Marshal(obj)
if err != nil {
return nil, err

Check warning on line 179 in flytepropeller/pkg/controller/nodes/attr_path_resolver.go

View check run for this annotation

Codecov / codecov/patch

flytepropeller/pkg/controller/nodes/attr_path_resolver.go#L177-L179

Added lines #L177 - L179 were not covered by tests
}
jsonBytes, err = msgpack.Marshal(jsonBytes)

Check warning on line 181 in flytepropeller/pkg/controller/nodes/attr_path_resolver.go

View check run for this annotation

Codecov / codecov/patch

flytepropeller/pkg/controller/nodes/attr_path_resolver.go#L181

Added line #L181 was not covered by tests
if err != nil {
return nil, err
}
literal.Value = &core.Literal_Scalar{
Scalar: &core.Scalar{
Value: &core.Scalar_Generic{
Generic: newSt,
Value: &core.Scalar_Json{
Json: &core.Json{
Value: jsonBytes,
},

Check warning on line 190 in flytepropeller/pkg/controller/nodes/attr_path_resolver.go

View check run for this annotation

Codecov / codecov/patch

flytepropeller/pkg/controller/nodes/attr_path_resolver.go#L187-L190

Added lines #L187 - L190 were not covered by tests
},
},
}
Expand Down

0 comments on commit d5d7b79

Please sign in to comment.