forked from rapidpro/mailroom
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from nyaruka/inspect_with_validation
🕵️♂️ The /flow/inspect endpoint should do optional validation
- Loading branch information
Showing
18 changed files
with
256 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"validate_with_org_id": 1, | ||
"flow": { | ||
"uuid": "8f107d42-7416-4cf2-9a51-9490361ad517", | ||
"name": "Invalid Flow", | ||
"spec_version": "13.0.0", | ||
"language": "eng", | ||
"type": "messaging", | ||
"revision": 106, | ||
"expire_after_minutes": 10080, | ||
"localization": {}, | ||
"nodes": [ | ||
{ | ||
"uuid": "6fde1a09-3997-47dd-aff0-92e8aff3a642", | ||
"actions": [ | ||
{ | ||
"type": "add_contact_groups", | ||
"uuid": "23337aa9-0d3d-4e70-876e-9a2633d1e5e4", | ||
"groups": [ | ||
{ | ||
"uuid": "5e9d8fab-5e7e-4f51-b533-261af5dea70d", | ||
"name": "Testers" | ||
} | ||
] | ||
} | ||
], | ||
"exits": [ | ||
{ | ||
"uuid": "d3f3f024-a90e-43a5-bd5a-7056f5bea699", | ||
"destination_uuid": "55fbef81-4151-4589-9f0a-8e5c44f6b5a3" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"error": "invalid node[uuid=6fde1a09-3997-47dd-aff0-92e8aff3a642]: destination 55fbef81-4151-4589-9f0a-8e5c44f6b5a3 of exit[uuid=d3f3f024-a90e-43a5-bd5a-7056f5bea699] isn't a known node" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"validate_with_org_id": 1, | ||
"flow": { | ||
"entry": "6fde1a09-3997-47dd-aff0-92e8aff3a642", | ||
"action_sets": [ | ||
{ | ||
"uuid": "6fde1a09-3997-47dd-aff0-92e8aff3a642", | ||
"x": 107, | ||
"y": 0, | ||
"destination": null, | ||
"actions": [ | ||
{ | ||
"type": "add_group", | ||
"uuid": "23337aa9-0d3d-4e70-876e-9a2633d1e5e4", | ||
"groups": [ | ||
{ | ||
"uuid": "1465eb20-066d-4933-a8b4-62fe7b19fd39", | ||
"name": "I Don't Exist" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "reply", | ||
"uuid": "05a5cb7c-bb8a-4ad9-af90-ef9887cc370e", | ||
"msg": { | ||
"eng": "Your birthdate is @contact.birthdate" | ||
}, | ||
"media": {}, | ||
"quick_replies": [], | ||
"send_all": false | ||
} | ||
], | ||
"exit_uuid": "d3f3f024-a90e-43a5-bd5a-7056f5bea699" | ||
} | ||
], | ||
"rule_sets": [], | ||
"base_language": "eng", | ||
"flow_type": "M", | ||
"version": "11.12", | ||
"metadata": { | ||
"expires": 10080, | ||
"saved_on": "2019-03-04T17:37:06.873734Z", | ||
"uuid": "8f107d42-7416-4cf2-9a51-9490361ad517", | ||
"name": "Valid Legacy Flow", | ||
"revision": 106 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"error": "missing dependencies: field[key=birthdate,name=],group[uuid=1465eb20-066d-4933-a8b4-62fe7b19fd39,name=I Don't Exist]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"flow": { | ||
"uuid": "8f107d42-7416-4cf2-9a51-9490361ad517", | ||
"name": "Valid Flow", | ||
"spec_version": "13.0.0", | ||
"language": "eng", | ||
"type": "messaging", | ||
"revision": 106, | ||
"expire_after_minutes": 10080, | ||
"localization": {}, | ||
"nodes": [ | ||
{ | ||
"uuid": "6fde1a09-3997-47dd-aff0-92e8aff3a642", | ||
"actions": [ | ||
{ | ||
"type": "add_contact_groups", | ||
"uuid": "23337aa9-0d3d-4e70-876e-9a2633d1e5e4", | ||
"groups": [ | ||
{ | ||
"uuid": "e484d7b8-aada-4b63-b498-4ba4fbcafbc7", | ||
"name": "No such group" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "send_msg", | ||
"uuid": "05a5cb7c-bb8a-4ad9-af90-ef9887cc370e", | ||
"text": "Your birthdate is @contact.fields.birthdate" | ||
} | ||
], | ||
"exits": [ | ||
{ | ||
"uuid": "d3f3f024-a90e-43a5-bd5a-7056f5bea699" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
web/flow/testdata/inspect_invalid_without_org.response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"dependencies": { | ||
"fields": [ | ||
{ | ||
"key": "birthdate", | ||
"name": "" | ||
} | ||
], | ||
"groups": [ | ||
{ | ||
"name": "No such group", | ||
"uuid": "e484d7b8-aada-4b63-b498-4ba4fbcafbc7" | ||
} | ||
] | ||
}, | ||
"results": [], | ||
"waiting_exits": [] | ||
} |
2 changes: 1 addition & 1 deletion
2
.../testdata/validate_legacy_single_msg.json → ...w/testdata/inspect_legacy_single_msg.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"dependencies": {}, | ||
"results": [], | ||
"waiting_exits": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"validate_with_org_id": 1, | ||
"flow": { | ||
"entry": "6fde1a09-3997-47dd-aff0-92e8aff3a642", | ||
"action_sets": [ | ||
{ | ||
"uuid": "6fde1a09-3997-47dd-aff0-92e8aff3a642", | ||
"x": 107, | ||
"y": 0, | ||
"destination": null, | ||
"actions": [ | ||
{ | ||
"type": "add_group", | ||
"uuid": "23337aa9-0d3d-4e70-876e-9a2633d1e5e4", | ||
"groups": [ | ||
{ | ||
"uuid": "5e9d8fab-5e7e-4f51-b533-261af5dea70d", | ||
"name": "Testers" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "reply", | ||
"uuid": "05a5cb7c-bb8a-4ad9-af90-ef9887cc370e", | ||
"msg": { | ||
"eng": "Your birthdate is soon" | ||
}, | ||
"media": {}, | ||
"quick_replies": [], | ||
"send_all": false | ||
} | ||
], | ||
"exit_uuid": "d3f3f024-a90e-43a5-bd5a-7056f5bea699" | ||
} | ||
], | ||
"rule_sets": [], | ||
"base_language": "eng", | ||
"flow_type": "M", | ||
"version": "11.12", | ||
"metadata": { | ||
"expires": 10080, | ||
"saved_on": "2019-03-04T17:37:06.873734Z", | ||
"uuid": "8f107d42-7416-4cf2-9a51-9490361ad517", | ||
"name": "Valid Legacy Flow", | ||
"revision": 106 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"dependencies": { | ||
"groups": [ | ||
{ | ||
"name": "Testers", | ||
"uuid": "5e9d8fab-5e7e-4f51-b533-261af5dea70d" | ||
} | ||
] | ||
}, | ||
"results": [], | ||
"waiting_exits": [] | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"dependencies": { | ||
"fields": [ | ||
{ | ||
"key": "birthdate", | ||
"name": "" | ||
} | ||
], | ||
"groups": [ | ||
{ | ||
"name": "Testers", | ||
"uuid": "5e9d8fab-5e7e-4f51-b533-261af5dea70d" | ||
} | ||
] | ||
}, | ||
"results": [], | ||
"waiting_exits": [] | ||
} |
42 changes: 0 additions & 42 deletions
42
web/flow/testdata/validate_legacy_single_msg.response.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.