-
Notifications
You must be signed in to change notification settings - Fork 0
Add manual/auto trigger and rework event and action transitions #412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,6 +112,7 @@ | |
| "Action": { | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "description": "Declares an action available while in this state.", | ||
| "properties": { | ||
| "name": { | ||
| "type": "string", | ||
|
|
@@ -121,11 +122,28 @@ | |
| "type": "string", | ||
| "description": "Description of the action" | ||
| }, | ||
| "trigger": { | ||
| "type": "string", | ||
| "description": "Trigger for the action", | ||
| "enum": [ | ||
| "auto", | ||
| "manual" | ||
| ], | ||
| "default": "manual" | ||
| }, | ||
|
Comment on lines
+125
to
+133
|
||
| "transitions": { | ||
| "type": "array", | ||
| "description": "List of all possible state transitions after performing the action. When no transitions are defined, the action is considered to be non-state-changing.", | ||
| "items": { | ||
| "type": "string" | ||
| "type": "object", | ||
| "description": "Action outcome to state transition mapping. When no transition is defined, the action is considered to be non-state-changing.", | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "success": { | ||
| "type": "string", | ||
| "description": "Target state when the action succeeds." | ||
| }, | ||
| "failure": { | ||
| "type": "string", | ||
| "description": "Target state when the action fails." | ||
| } | ||
| } | ||
| } | ||
| }, | ||
|
|
@@ -137,6 +155,7 @@ | |
| "Event": { | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "description": "Declares an event considered for transition while in this state.", | ||
| "properties": { | ||
| "name": { | ||
| "type": "string", | ||
|
|
@@ -146,12 +165,9 @@ | |
| "type": "string", | ||
| "description": "Description of the event" | ||
| }, | ||
| "transitions": { | ||
| "type": "array", | ||
| "description": "List of all possible state transitions after triggering the event. When no transitions are defined, the event is considered to be non-state-changing.", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| "transition": { | ||
| "type": "string", | ||
| "description": "State transition after event has occurred. When no transition is defined, the event is considered to be non-state-changing." | ||
| } | ||
| }, | ||
| "required": [ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
triggerfield in the Action schema has adefaultvalue of "manual", but JSON Schema'sdefaultkeyword is only advisory for documentation purposes - it doesn't actually set default values during validation or parsing.If you want actions to have a default trigger of "manual", you'll need to handle this in the application code that reads the state model. Alternatively, if the trigger field should be required, add it to the
requiredarray on line 150.