From b78df907de92a88cd47c65b8f11f23dad8458336 Mon Sep 17 00:00:00 2001 From: Ingo Date: Wed, 24 Apr 2024 13:20:19 +0200 Subject: [PATCH] allow empty IotOption selection --- pkg/analytics/analytics.go | 5 ++++- pkg/analytics/parameter.go | 5 +---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/analytics/analytics.go b/pkg/analytics/analytics.go index e0c2134..ac275a1 100644 --- a/pkg/analytics/analytics.go +++ b/pkg/analytics/analytics.go @@ -281,6 +281,9 @@ func (this *Analytics) inputsToNodes(token auth.Token, task model.CamundaExterna if err != nil { return result, err } + if selection.DeviceSelection == nil && selection.ImportSelection == nil && selection.DeviceGroupSelection == nil { + continue + } nodeInput, err := this.selectionToNodeInputs(token, selection, task, input.Id, port) if err != nil { return result, err @@ -336,7 +339,7 @@ func (this *Analytics) selectionToNodeInputs(token auth.Token, selection model.I if selection.DeviceGroupSelection != nil { return this.groupSelectionToNodeInputs(token, *selection.DeviceGroupSelection, task, inputId, portName) } - return []NodeInput{}, nil + return result, errors.New("expect selection to contain none nil value") } func (this *Analytics) deviceSelectionToNodeInputs(selection model.DeviceSelection, inputPort string) (result []NodeInput, err error) { diff --git a/pkg/analytics/parameter.go b/pkg/analytics/parameter.go index a241f00..8c6d8f7 100644 --- a/pkg/analytics/parameter.go +++ b/pkg/analytics/parameter.go @@ -196,10 +196,7 @@ func (this *Analytics) getSelection(task model.CamundaExternalTask, inputId stri if err != nil { return result, fmt.Errorf("unable to interpret pipeline input selection (%v): %w", variableName, err) } - if result.DeviceSelection == nil && result.ImportSelection == nil && result.DeviceGroupSelection == nil { - return result, fmt.Errorf("unable to interpret pipeline input selection (%v): %v", variableName, "expect selection to contain none nil value") - } - return result, err + return result, nil } func (this *Analytics) getNodePathCriteria(task model.CamundaExternalTask, inputId string, portName string) (result []devices.FilterCriteria, err error) {