File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package main
22
33import (
44 "context"
5+ "maps"
56 "reflect"
67 "sort"
78
@@ -80,12 +81,20 @@ func (f *Function) RunFunction(_ context.Context, req *fnv1.RunFunctionRequest)
8081 return rsp , nil
8182 }
8283
83- s , err := structpb .NewStruct (verifiedExtras )
84+ out , err := structpb .NewStruct (verifiedExtras )
8485 if err != nil {
8586 response .Fatal (rsp , errors .Wrapf (err , "cannot create new Struct from extra resources output" ))
8687 return rsp , nil
8788 }
88- response .SetContextKey (rsp , in .Spec .Context .GetKey (), structpb .NewStructValue (s ))
89+
90+ if v , ok := request .GetContextKey (req , in .Spec .Context .GetKey ()); ok {
91+ if s := v .GetStructValue (); s != nil {
92+ maps .Copy (s .Fields , out .Fields )
93+ out = s
94+ }
95+ }
96+
97+ response .SetContextKey (rsp , in .Spec .Context .GetKey (), structpb .NewStructValue (out ))
8998
9099 return rsp , nil
91100}
You can’t perform that action at this time.
0 commit comments