Skip to content

Commit aca5116

Browse files
authored
Workflows: Make request types optional and use proto strings (#3624)
Signed-off-by: joshvanl <[email protected]>
1 parent fc8636d commit aca5116

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

tests/conformance/workflows/workflows.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ package workflows
1515

1616
import (
1717
"context"
18-
"encoding/json"
1918
"testing"
2019
"time"
2120

2221
"github.com/stretchr/testify/assert"
2322
"github.com/stretchr/testify/require"
23+
"google.golang.org/protobuf/types/known/wrapperspb"
2424

2525
"github.com/dapr/kit/logger"
2626

@@ -61,14 +61,12 @@ func ConformanceTests(t *testing.T, props map[string]string, workflowItem workfl
6161
t.Run("start", func(t *testing.T) {
6262
testLogger.Info("Start test running...")
6363

64-
inputBytes, _ := json.Marshal(10) // Time that the activity within the workflow runs for
65-
6664
testInstanceID := "TestID"
6765
t.Run("start", func(t *testing.T) {
6866
req := &workflows.StartRequest{
69-
InstanceID: testInstanceID,
67+
InstanceID: &testInstanceID,
7068
WorkflowName: "TestWorkflow",
71-
WorkflowInput: inputBytes,
69+
WorkflowInput: wrapperspb.String("10"),
7270
Options: map[string]string{
7371
"task_queue": "TestTaskQueue",
7472
},

workflows/requests.go

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package workflows
22

3+
import "google.golang.org/protobuf/types/known/wrapperspb"
4+
35
// StartRequest is the struct describing a start workflow request.
46
type StartRequest struct {
5-
InstanceID string `json:"instanceID"`
6-
Options map[string]string `json:"options"`
7-
WorkflowName string `json:"workflowName"`
8-
WorkflowInput []byte `json:"workflowInput"`
7+
InstanceID *string `json:"instanceID"`
8+
Options map[string]string `json:"options"`
9+
WorkflowName string `json:"workflowName"`
10+
WorkflowInput *wrapperspb.StringValue `json:"workflowInput"`
911
}
1012

1113
// GetRequest is the struct describing a get workflow state request.
@@ -16,14 +18,14 @@ type GetRequest struct {
1618
// TerminateRequest is the struct describing a terminate workflow request.
1719
type TerminateRequest struct {
1820
InstanceID string `json:"instanceID"`
19-
Recursive bool `json:"recursive"`
21+
Recursive *bool `json:"recursive"`
2022
}
2123

2224
// RaiseEventRequest is the struct describing a raise workflow event request.
2325
type RaiseEventRequest struct {
24-
InstanceID string `json:"instanceID"`
25-
EventName string `json:"name"`
26-
EventData []byte `json:"data"`
26+
InstanceID string `json:"instanceID"`
27+
EventName string `json:"name"`
28+
EventData *wrapperspb.StringValue `json:"data"`
2729
}
2830

2931
// PauseRequest is the struct describing a pause workflow request.
@@ -39,5 +41,5 @@ type ResumeRequest struct {
3941
// PurgeRequest is the object describing a Purge request.
4042
type PurgeRequest struct {
4143
InstanceID string `json:"instanceID"`
42-
Recursive bool `json:"recursive"`
44+
Recursive *bool `json:"recursive"`
4345
}

0 commit comments

Comments
 (0)