You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2021/07/15 14:34:27 UTC
[camel-k] branch main updated: fix(cmd/bind): nullable error-handler
This is an automated email from the ASF dual-hosted git repository.
nferraro pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push:
new 330b702 fix(cmd/bind): nullable error-handler
330b702 is described below
commit 330b7024e7ddae8eb26418d2d6c22da0ffc3bed1
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Mon Jul 12 17:25:19 2021 +0200
fix(cmd/bind): nullable error-handler
Using a pointer in order to admit an empty value instead of a null when marshalling the KameletBindingSpec
Closes #2493
---
pkg/apis/camel/v1alpha1/kamelet_binding_types.go | 2 +-
pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go | 6 +++++-
pkg/controller/kameletbinding/error_handler.go | 4 ++--
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/pkg/apis/camel/v1alpha1/kamelet_binding_types.go b/pkg/apis/camel/v1alpha1/kamelet_binding_types.go
index cfe8779..4341c1c 100644
--- a/pkg/apis/camel/v1alpha1/kamelet_binding_types.go
+++ b/pkg/apis/camel/v1alpha1/kamelet_binding_types.go
@@ -33,7 +33,7 @@ type KameletBindingSpec struct {
// Sink is the destination of the integration defined by this binding
Sink Endpoint `json:"sink,omitempty"`
// ErrorHandler is an optional handler called upon an error occuring in the integration
- ErrorHandler ErrorHandlerSpec `json:"errorHandler,omitempty"`
+ ErrorHandler *ErrorHandlerSpec `json:"errorHandler,omitempty"`
// Steps contains an optional list of intermediate steps that are executed between the Source and the Sink
Steps []Endpoint `json:"steps,omitempty"`
}
diff --git a/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go
index e690240..c0437a9 100644
--- a/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go
@@ -535,7 +535,11 @@ func (in *KameletBindingSpec) DeepCopyInto(out *KameletBindingSpec) {
}
in.Source.DeepCopyInto(&out.Source)
in.Sink.DeepCopyInto(&out.Sink)
- in.ErrorHandler.DeepCopyInto(&out.ErrorHandler)
+ if in.ErrorHandler != nil {
+ in, out := &in.ErrorHandler, &out.ErrorHandler
+ *out = new(ErrorHandlerSpec)
+ (*in).DeepCopyInto(*out)
+ }
if in.Steps != nil {
in, out := &in.Steps, &out.Steps
*out = make([]Endpoint, len(*in))
diff --git a/pkg/controller/kameletbinding/error_handler.go b/pkg/controller/kameletbinding/error_handler.go
index 5325324..4f71156 100644
--- a/pkg/controller/kameletbinding/error_handler.go
+++ b/pkg/controller/kameletbinding/error_handler.go
@@ -27,9 +27,9 @@ import (
"github.com/pkg/errors"
)
-func maybeErrorHandler(errHandlConf v1alpha1.ErrorHandlerSpec, bindingContext bindings.BindingContext) (*bindings.Binding, error) {
+func maybeErrorHandler(errHandlConf *v1alpha1.ErrorHandlerSpec, bindingContext bindings.BindingContext) (*bindings.Binding, error) {
var errorHandlerBinding *bindings.Binding
- if errHandlConf.RawMessage != nil {
+ if errHandlConf != nil && &errHandlConf.RawMessage != nil {
errorHandlerSpec, err := parseErrorHandler(errHandlConf.RawMessage)
if err != nil {
return nil, errors.Wrap(err, "could not parse error handler")