MCPcopy Create free account
hub / github.com/crossplane-contrib/function-patch-and-transform / toValidJSON

Function toValidJSON

patches.go:105–115  ·  view source on GitHub ↗
(value any)

Source from the content-addressed store, hash-verified

103}
104
105func toValidJSON(value any) (any, error) {
106 var v any
107 j, err := json.Marshal(value)
108 if err != nil {
109 return nil, errors.Wrap(err, "cannot marshal value to JSON")
110 }
111 if err := json.Unmarshal(j, &v); err != nil {
112 return nil, errors.Wrap(err, "cannot unmarshal value from JSON")
113 }
114 return v, nil
115}
116
117// toMergeOption returns the MergeOptions from the PatchPolicy's ToFieldPathPolicy, if defined.
118func toMergeOption(p PatchInterface) (mo *xpv1.MergeOptions, err error) {

Callers 1

ApplyFromFieldPathPatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected