Skip to content

Commit

Permalink
Workflows: Make request types optional and use proto strings (#3624)
Browse files Browse the repository at this point in the history
Signed-off-by: joshvanl <[email protected]>
  • Loading branch information
JoshVanL authored Dec 16, 2024
1 parent fc8636d commit aca5116
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
File renamed without changes.
8 changes: 3 additions & 5 deletions tests/conformance/workflows/workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ package workflows

import (
"context"
"encoding/json"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/types/known/wrapperspb"

"github.com/dapr/kit/logger"

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

inputBytes, _ := json.Marshal(10) // Time that the activity within the workflow runs for

testInstanceID := "TestID"
t.Run("start", func(t *testing.T) {
req := &workflows.StartRequest{
InstanceID: testInstanceID,
InstanceID: &testInstanceID,
WorkflowName: "TestWorkflow",
WorkflowInput: inputBytes,
WorkflowInput: wrapperspb.String("10"),
Options: map[string]string{
"task_queue": "TestTaskQueue",
},
Expand Down
20 changes: 11 additions & 9 deletions workflows/requests.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package workflows

import "google.golang.org/protobuf/types/known/wrapperspb"

// StartRequest is the struct describing a start workflow request.
type StartRequest struct {
InstanceID string `json:"instanceID"`
Options map[string]string `json:"options"`
WorkflowName string `json:"workflowName"`
WorkflowInput []byte `json:"workflowInput"`
InstanceID *string `json:"instanceID"`
Options map[string]string `json:"options"`
WorkflowName string `json:"workflowName"`
WorkflowInput *wrapperspb.StringValue `json:"workflowInput"`
}

// GetRequest is the struct describing a get workflow state request.
Expand All @@ -16,14 +18,14 @@ type GetRequest struct {
// TerminateRequest is the struct describing a terminate workflow request.
type TerminateRequest struct {
InstanceID string `json:"instanceID"`
Recursive bool `json:"recursive"`
Recursive *bool `json:"recursive"`
}

// RaiseEventRequest is the struct describing a raise workflow event request.
type RaiseEventRequest struct {
InstanceID string `json:"instanceID"`
EventName string `json:"name"`
EventData []byte `json:"data"`
InstanceID string `json:"instanceID"`
EventName string `json:"name"`
EventData *wrapperspb.StringValue `json:"data"`
}

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

0 comments on commit aca5116

Please sign in to comment.