chore: Simply type integration Flows as string
diff --git a/deploy/crd-integration.yaml b/deploy/crd-integration.yaml
index 208204b..30d8dce 100644
--- a/deploy/crd-integration.yaml
+++ b/deploy/crd-integration.yaml
@@ -84,9 +84,9 @@
type: array
flows:
items:
- $ref: '#/definitions/encoding~1json~0RawMessage'
description: Flow is an unstructured object representing a Camel
Flow in YAML/JSON DSL
+ type: string
type: array
kit:
type: string
diff --git a/e2e/knative/knative_platform_test.go b/e2e/knative/knative_platform_test.go
index da40c46..f3aa846 100644
--- a/e2e/knative/knative_platform_test.go
+++ b/e2e/knative/knative_platform_test.go
@@ -55,7 +55,7 @@
it.Spec.Profile = ""
var flows []v1.Flow
for _, flow := range it.Spec.Flows {
- flows = append(flows, []byte(strings.ReplaceAll(string(flow), "string!", "string!!!")))
+ flows = append(flows, v1.Flow(strings.ReplaceAll(string(flow), "string!", "string!!!")))
}
it.Spec.Flows = flows
})).To(BeNil())
diff --git a/pkg/apis/camel/v1/common_types.go b/pkg/apis/camel/v1/common_types.go
index 83ecb90..b523ffe 100644
--- a/pkg/apis/camel/v1/common_types.go
+++ b/pkg/apis/camel/v1/common_types.go
@@ -18,8 +18,6 @@
package v1
import (
- "encoding/json"
-
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@@ -134,4 +132,4 @@
}
// Flow is an unstructured object representing a Camel Flow in YAML/JSON DSL
-type Flow json.RawMessage
+type Flow string
diff --git a/pkg/apis/camel/v1/zz_generated.deepcopy.go b/pkg/apis/camel/v1/zz_generated.deepcopy.go
index 4daba34..87f7ff9 100644
--- a/pkg/apis/camel/v1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/zz_generated.deepcopy.go
@@ -615,26 +615,6 @@
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in Flow) DeepCopyInto(out *Flow) {
- {
- in := &in
- *out = make(Flow, len(*in))
- copy(*out, *in)
- return
- }
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Flow.
-func (in Flow) DeepCopy() Flow {
- if in == nil {
- return nil
- }
- out := new(Flow)
- in.DeepCopyInto(out)
- return *out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImageTask) DeepCopyInto(out *ImageTask) {
*out = *in
in.ContainerTask.DeepCopyInto(&out.ContainerTask)
@@ -1103,13 +1083,7 @@
if in.Flows != nil {
in, out := &in.Flows, &out.Flows
*out = make([]Flow, len(*in))
- for i := range *in {
- if (*in)[i] != nil {
- in, out := &(*in)[i], &(*out)[i]
- *out = make(Flow, len(*in))
- copy(*out, *in)
- }
- }
+ copy(*out, *in)
}
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go
index e18494d..fce05e7 100644
--- a/pkg/cmd/run.go
+++ b/pkg/cmd/run.go
@@ -471,8 +471,7 @@
}
if o.UseFlows && (strings.HasSuffix(source, ".yaml") || strings.HasSuffix(source, ".yml")) {
- flows := []byte(data)
- integration.Spec.AddFlows(flows)
+ integration.Spec.AddFlows(v1.Flow(data))
} else {
integration.Spec.AddSources(v1.SourceSpec{
DataSpec: v1.DataSpec{
diff --git a/pkg/util/digest/digest.go b/pkg/util/digest/digest.go
index c6dec3c..bc4ff63 100644
--- a/pkg/util/digest/digest.go
+++ b/pkg/util/digest/digest.go
@@ -68,7 +68,7 @@
// Integration flows
for _, flow := range integration.Spec.Flows {
- if _, err := hash.Write(flow); err != nil {
+ if _, err := hash.Write([]byte(flow)); err != nil {
return "", err
}
}