chore(api): make KameletSpec.Definition a pointer so it can be omitted
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 3a55ff4..561556f 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -904,7 +904,7 @@
Name: name,
},
Spec: v1alpha1.KameletSpec{
- Definition: v1alpha1.JSONSchemaProps{
+ Definition: &v1alpha1.JSONSchemaProps{
Properties: map[string]v1alpha1.JSONSchemaProps{
"message": {
Type: "string",
diff --git a/pkg/apis/camel/v1alpha1/kamelet_types.go b/pkg/apis/camel/v1alpha1/kamelet_types.go
index 252d733..7a1cef7 100644
--- a/pkg/apis/camel/v1alpha1/kamelet_types.go
+++ b/pkg/apis/camel/v1alpha1/kamelet_types.go
@@ -33,7 +33,7 @@
// KameletSpec defines the desired state of Kamelet
type KameletSpec struct {
- Definition JSONSchemaProps `json:"definition,omitempty"`
+ Definition *JSONSchemaProps `json:"definition,omitempty"`
Sources []camelv1.SourceSpec `json:"sources,omitempty"`
Flow *camelv1.Flow `json:"flow,omitempty"`
Authorization *AuthorizationSpec `json:"authorization,omitempty"`
diff --git a/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go
index 9741e33..bb1ef9e 100644
--- a/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go
@@ -600,7 +600,11 @@
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *KameletSpec) DeepCopyInto(out *KameletSpec) {
*out = *in
- in.Definition.DeepCopyInto(&out.Definition)
+ if in.Definition != nil {
+ in, out := &in.Definition, &out.Definition
+ *out = new(JSONSchemaProps)
+ (*in).DeepCopyInto(*out)
+ }
if in.Sources != nil {
in, out := &in.Sources, &out.Sources
*out = make([]v1.SourceSpec, len(*in))
diff --git a/pkg/kamelet/initialize.go b/pkg/kamelet/initialize.go
index 991b5bd..755c9fc 100644
--- a/pkg/kamelet/initialize.go
+++ b/pkg/kamelet/initialize.go
@@ -55,6 +55,10 @@
}
func recomputeProperties(kamelet *v1alpha1.Kamelet) error {
+ if kamelet.Spec.Definition == nil {
+ return nil
+ }
+
kamelet.Status.Properties = make([]v1alpha1.KameletProperty, 0, len(kamelet.Spec.Definition.Properties))
propSet := make(map[string]bool)
for k, v := range kamelet.Spec.Definition.Properties {
diff --git a/pkg/trait/kamelets.go b/pkg/trait/kamelets.go
index 390c754..6344160 100644
--- a/pkg/trait/kamelets.go
+++ b/pkg/trait/kamelets.go
@@ -18,7 +18,6 @@
package trait
import (
- "encoding/json"
"fmt"
"regexp"
"sort"
@@ -360,12 +359,6 @@
}
// Create configmaps to avoid storing kamelet definitions in the integration CR
-
- schema, err := json.Marshal(kamelet.Spec.Definition)
- if err != nil {
- return v1.SourceSpec{}, err
- }
-
// Compute the input digest and store it along with the configmap
hash, err := digest.ComputeForSource(source)
if err != nil {
@@ -395,7 +388,6 @@
},
Data: map[string]string{
contentKey: source.Content,
- schemaKey: string(schema),
},
}