Skip to content

Commit

Permalink
make sure destination_node_uuid can be null
Browse files Browse the repository at this point in the history
  • Loading branch information
nicpottier committed Jun 5, 2017
1 parent cf02880 commit 3440d7a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions cmd/flowrunner/testdata/flows/brochure.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
},
{
"uuid": "7acb54fd-0db0-40b9-970b-93f7bfb4277b",
"exits": [
{
"uuid": "388bbce3-8079-4573-922f-8dea469d93f3",
"destination_node_uuid": null
}
],
"actions": [
{
"uuid": "455ba297-f6d2-45e6-bf3e-c1ef028b55ae",
Expand Down
2 changes: 1 addition & 1 deletion flows/actions/save_contact_field.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const TypeSaveContactField string = "save_contact_field"
// @action save_contact_field
type SaveContactField struct {
BaseAction
FieldUUID flows.FieldUUID `json:"field_uuid" validate:"uuid4"`
FieldUUID flows.FieldUUID `json:"field_uuid" validate:"required,uuid4"`
FieldName string `json:"field_name" validate:"required"`
Value string `json:"value" validate:"required"`
}
Expand Down
2 changes: 1 addition & 1 deletion flows/definition/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (n *node) MarshalJSON() ([]byte, error) {

type exitEnvelope struct {
UUID flows.ExitUUID `json:"uuid" validate:"required,uuid4"`
DestinationNodeUUID flows.NodeUUID `json:"destination_node_uuid,omitempty" validate:"uuid4"`
DestinationNodeUUID flows.NodeUUID `json:"destination_node_uuid,omitempty" validate:"omitempty,uuid4"`
Name string `json:"name,omitempty"`
}

Expand Down
2 changes: 1 addition & 1 deletion flows/routers/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Case struct {
}

type SwitchRouter struct {
Default flows.ExitUUID `json:"default_exit_uuid"`
Default flows.ExitUUID `json:"default_exit_uuid" validate:"omitempty,uuid4"`
Operand string `json:"operand" validate:"required"`
Cases []Case `json:"cases"`
BaseRouter
Expand Down

0 comments on commit 3440d7a

Please sign in to comment.