-
Notifications
You must be signed in to change notification settings - Fork 0
/
workflow
1065 lines (1064 loc) · 37.3 KB
/
workflow
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"$id": "https://cisco.com/fso/schemas/codex/workflow.json",
"name": "workflow",
"identifyingProperties" : [
"/id"
],
"displayNameGenerationMechanism" : "{{object.name}}",
"allowObjectFragments": false,
"allowedLayers": [
"SOLUTION",
"TENANT"
],
"referenceQualifiers" : {
"$.events[:].type" : [
"/contracts/cloudevent"
]
},
"jsonSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - workflow schema",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Workflow unique identifier",
"minLength": 1
},
"key": {
"type": "string",
"description": "Domain-specific workflow identifier",
"minLength": 1
},
"name": {
"type": "string",
"description": "Workflow name",
"minLength": 1
},
"description": {
"type": "string",
"description": "Workflow description"
},
"version": {
"type": "string",
"description": "Workflow version",
"minLength": 1
},
"annotations": {
"type": "array",
"description": "List of helpful terms describing the workflows intended purpose, subject areas, or other important qualities",
"minItems": 1,
"items": {
"type": "string"
},
"additionalItems": false
},
"start": {
"$ref": "#/definitions/startdef"
},
"specVersion": {
"type": "string",
"description": "Serverless Workflow schema version",
"enum" : ["0.8"]
},
"expressionLang": {
"const": "jsonata",
"description": "Identifies the expression language used for workflow expressions",
"minLength": 1
},
"timeouts": {
"oneOf": [{
"type": "string",
"format": "uri",
"description": "URI to a resource containing timeouts definitions (json or yaml)"
}, {
"type": "object",
"description": "Workflow default timeouts",
"properties": {
"workflowExecTimeout": {
"oneOf": [{
"type": "string",
"description": "Workflow execution timeout duration (ISO 8601 duration format). If not specified should be 'unlimited'",
"minLength": 1
}, {
"type": "object",
"properties": {
"duration": {
"type": "string",
"description": "Workflow execution timeout duration (ISO 8601 duration format). If not specified should be 'unlimited'",
"minLength": 1
},
"interrupt": {
"type": "boolean",
"description": "If `false`, workflow instance is allowed to finish current execution. If `true`, current workflow execution is abrupted.",
"default": true
},
"runBefore": {
"type": "string",
"description": "Name of a workflow state to be executed before workflow instance is terminated",
"minLength": 1
}
},
"additionalProperties": false,
"required": ["duration"]
}]
},
"stateExecTimeout": {
"$ref": "#/definitions/eventstate/properties/timeouts/properties/stateExecTimeout"
},
"actionExecTimeout": {
"$ref": "#/definitions/branch/properties/timeouts/properties/actionExecTimeout"
},
"branchExecTimeout": {
"$ref": "#/definitions/branch/properties/timeouts/properties/branchExecTimeout"
},
"eventTimeout": {
"$ref": "#/definitions/eventstate/properties/timeouts/properties/eventTimeout"
}
},
"additionalProperties": false,
"required": []
}]
},
"errors": {
"oneOf": [{
"type": "string",
"format": "uri",
"description": "URI to a resource containing error definitions (json or yaml)"
}, {
"type": "array",
"description": "Workflow Error definitions. Defines checked errors that can be explicitly handled during workflow execution",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Domain-specific error name",
"minLength": 1
},
"code": {
"type": "string",
"description": "Error code. Can be used in addition to the name to help runtimes resolve to technical errors/exceptions. Should not be defined if error is set to '*'",
"minLength": 1
},
"description": {
"type": "string",
"description": "Error description"
}
},
"additionalProperties": false,
"required": ["name"]
},
"additionalItems": false,
"minItems": 1
}]
},
"keepActive": {
"type": "boolean",
"default": false,
"description": "If 'true', workflow instances is not terminated when there are no active execution paths. Instance can be terminated via 'terminate end definition' or reaching defined 'workflowExecTimeout'"
},
"metadata": {
"type": "object",
"description": "Metadata information",
"additionalProperties": {
"type": "string"
}
},
"events": {
"type": "array",
"description": "Workflow CloudEvent definitions. Defines CloudEvents that can be consumed or produced",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Unique event name",
"minLength": 1
},
"source": {
"type": "string",
"description": "CloudEvent source"
},
"type": {
"type": "string",
"description": "CloudEvent type",
"enum" : [
"contracts:cloudevent/platform:metric.enriched.v1",
"contracts:cloudevent/platform:event.enriched.v1",
"contracts:cloudevent/platform:trace.enriched.v1",
"contracts:cloudevent/platform:association.observed.v1",
"contracts:cloudevent/platform:entity.observed.v1",
"contracts:cloudevent/platform:extension.observed.v1",
"contracts:cloudevent/platform:measurement.received.v1",
"contracts:cloudevent/platform:event.processed.v1"
]
},
"kind": {
"type": "string",
"enum": ["consumed", "produced"],
"description": "Defines the CloudEvent as either 'consumed' or 'produced' by the workflow. Default is 'consumed'",
"default": "consumed"
},
"dataOnly": {
"type": "boolean",
"default": true,
"description": "If `true`, only the Event payload is accessible to consuming Workflow states. If `false`, both event payload and context attributes should be accessible "
},
"metadata": {
"$ref": "#/properties/metadata",
"description": "Metadata information"
}
},
"additionalProperties": false,
"if": {
"properties": {
"kind": {
"const": "consumed"
}
}
},
"then": {
"required": ["name", "source", "type"]
},
"else": {
"required": ["name", "type"]
}
},
"additionalItems": false,
"minItems": 1
},
"functions": {
"type": "array",
"description": "Workflow function definitions",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Unique function name",
"minLength": 1
},
"operation": {
"type": "string",
"description": "If type is `rest`, <path_to_openapi_definition>#<operation_id>. If type is `asyncapi`, <path_to_asyncapi_definition>#<operation_id>. If type is `rpc`, <path_to_grpc_proto_file>#<service_name>#<service_method>. If type is `graphql`, <url_to_graphql_endpoint>#<literal \\\"mutation\\\" or \\\"query\\\">#<query_or_mutation_name>. If type is `odata`, <URI_to_odata_service>#<Entity_Set_Name>. If type is `expression`, defines the workflow expression.",
"minLength": 1
},
"type": {
"type": "string",
"description": "Defines the function type. Is either `rest`, `asyncapi, `rpc`, `graphql`, `odata`, `expression`, or `custom`. Default is `rest`",
"enum": ["rest", "asyncapi", "rpc", "graphql", "odata", "expression", "custom"],
"default": "rest"
},
"authRef": {
"oneOf": [{
"type": "string",
"description": "References the auth definition to be used to invoke the operation",
"minLength": 1
}, {
"type": "object",
"description": "Configures both the auth definition used to retrieve the operation's resource and the auth definition used to invoke said operation",
"properties": {
"resource": {
"type": "string",
"description": "References an auth definition to be used to access the resource defined in the operation parameter",
"minLength": 1
},
"invocation": {
"type": "string",
"description": "References an auth definition to be used to invoke the operation"
}
},
"additionalProperties": false,
"required": ["resource"]
}]
},
"metadata": {
"$ref": "#/properties/metadata"
}
},
"additionalProperties": false,
"required": ["name", "operation"]
},
"additionalItems": false,
"minItems": 1
},
"states": {
"type": "array",
"description": "State definitions",
"items": {
"anyOf": [{
"title": "Event State",
"$ref": "#/definitions/eventstate"
}, {
"title": "Operation State",
"$ref": "#/definitions/operationstate"
}, {
"title": "Parallel State",
"$ref": "#/definitions/parallelstate"
}, {
"title": "Switch State",
"$ref": "#/definitions/switchstate"
}, {
"title": "ForEach State",
"$ref": "#/definitions/foreachstate"
}]
},
"additionalItems": false,
"minItems": 1
}
},
"required": ["id", "specVersion", "states"],
"definitions": {
"transition": {
"oneOf": [{
"type": "string",
"description": "Name of state to transition to",
"minLength": 1
}, {
"type": "object",
"description": "Function Reference",
"properties": {
"nextState": {
"type": "string",
"description": "Name of state to transition to",
"minLength": 1
},
"produceEvents": {
"type": "array",
"description": "Array of events to be produced before the transition happens",
"items": {
"type": "object",
"$ref": "#/definitions/produceeventdef"
},
"additionalItems": false
}
},
"additionalProperties": false,
"required": ["nextState"]
}]
},
"onevents": {
"type": "object",
"properties": {
"eventRefs": {
"type": "array",
"description": "References one or more unique event names in the defined workflow events",
"minItems": 1,
"items": {
"type": "string"
},
"uniqueItems": true,
"additionalItems": false
},
"actionMode": {
"type": "string",
"enum": ["sequential", "parallel"],
"description": "Specifies how actions are to be performed (in sequence or in parallel)",
"default": "sequential"
},
"actions": {
"type": "array",
"description": "Actions to be performed if expression matches",
"items": {
"type": "object",
"$ref": "#/definitions/action"
},
"additionalItems": false
},
"eventDataFilter": {
"description": "Event data filter",
"$ref": "#/definitions/eventdatafilter"
}
},
"additionalProperties": false,
"required": ["eventRefs"]
},
"action": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Unique action definition name"
},
"functionRef": {
"description": "References a function to be invoked",
"$ref": "#/definitions/functionref"
},
"eventRef": {
"description": "References a `produce` and `consume` reusable event definitions",
"$ref": "#/definitions/eventref"
},
"subFlowRef": {
"description": "References a sub-workflow to invoke",
"$ref": "#/definitions/subflowref"
},
"actionDataFilter": {
"description": "Action data filter",
"$ref": "#/definitions/actiondatafilter"
},
"condition": {
"description": "Expression, if defined, must evaluate to true for this action to be performed. If false, action is disregarded",
"type": "string",
"minLength": 1
}
},
"additionalProperties": false,
"oneOf": [{
"required": ["functionRef"]
}, {
"required": ["eventRef"]
}, {
"required": ["subFlowRef"]
}]
},
"functionref": {
"type": "object",
"description": "Function Reference",
"properties": {
"refName": {
"type": "string",
"description": "Name of the referenced function"
},
"arguments": {
"type": "object",
"description": "Function arguments/inputs"
},
"invoke": {
"type": "string",
"enum": ["sync", "async"],
"description": "Specifies if the function should be invoked sync or async",
"default": "sync"
}
},
"additionalProperties": false,
"required": ["refName"]
},
"eventref": {
"type": "object",
"description": "Event References",
"properties": {
"produceEventRef": {
"type": "string",
"description": "Reference to the unique name of a 'produced' event definition"
},
"consumeEventRef": {
"type": "string",
"description": "Reference to the unique name of a 'consumed' event definition"
},
"consumeEventTimeout": {
"type": "string",
"description": "Maximum amount of time (ISO 8601 format) to wait for the result event. If not defined it should default to the actionExecutionTimeout"
},
"data": {
"type": ["string", "object"],
"description": "If string type, an expression which selects parts of the states data output to become the data (payload) of the event referenced by 'produceEventRef'. If object type, a custom object to become the data (payload) of the event referenced by 'produceEventRef'."
},
"contextAttributes": {
"type": "object",
"description": "Add additional extension context attributes to the produced event",
"additionalProperties": {
"type": "string"
}
}
},
"additionalProperties": false,
"required": ["produceEventRef"]
},
"subflowref": {
"oneOf": [{
"type": "string",
"description": "Unique id of the sub-workflow to be invoked",
"minLength": 1
}, {
"type": "object",
"description": "Specifies a sub-workflow to be invoked",
"properties": {
"workflowId": {
"type": "string",
"description": "Unique id of the sub-workflow to be invoked"
},
"version": {
"type": "string",
"description": "Version of the sub-workflow to be invoked",
"minLength": 1
},
"onParentComplete": {
"type": "string",
"enum": ["continue", "terminate"],
"description": "If invoke is 'async', specifies how subflow execution should behave when parent workflow completes. Default is 'terminate'",
"default": "terminate"
},
"invoke": {
"type": "string",
"enum": ["sync", "async"],
"description": "Specifies if the subflow should be invoked sync or async",
"default": "sync"
}
},
"required": ["workflowId"]
}]
},
"branch": {
"type": "object",
"description": "Branch Definition",
"properties": {
"name": {
"type": "string",
"description": "Branch name"
},
"timeouts": {
"type": "object",
"description": "State specific timeouts",
"properties": {
"actionExecTimeout": {
"type": "string",
"description": "Action execution timeout duration (ISO 8601 duration format)",
"minLength": 1
},
"branchExecTimeout": {
"type": "string",
"description": "Branch execution timeout duration (ISO 8601 duration format)",
"minLength": 1
}
},
"required": []
},
"actions": {
"type": "array",
"description": "Actions to be executed in this branch",
"items": {
"type": "object",
"$ref": "#/definitions/action"
},
"additionalItems": false
}
},
"additionalProperties": false,
"required": ["name", "actions"]
},
"eventstate": {
"type": "object",
"description": "This state is used to wait for events from event sources, then consumes them and invoke one or more actions to run in sequence or parallel",
"properties": {
"name": {
"type": "string",
"description": "State name"
},
"type": {
"type": "string",
"const": "event",
"description": "State type"
},
"exclusive": {
"type": "boolean",
"const": true,
"description": "If true consuming one of the defined events causes its associated actions to be performed. If false all of the defined events must be consumed in order for actions to be performed"
},
"onEvents": {
"type": "array",
"description": "Define the events to be consumed and optional actions to be performed",
"items": {
"type": "object",
"$ref": "#/definitions/onevents"
},
"additionalItems": false
},
"timeouts": {
"type": "object",
"description": "State specific timeouts",
"properties": {
"stateExecTimeout": {
"type": "string",
"description": "Workflow state execution timeout duration (ISO 8601 duration format)",
"minLength": 1
},
"actionExecTimeout": {
"$ref": "#/definitions/branch/properties/timeouts/properties/actionExecTimeout"
},
"eventTimeout": {
"type": "string",
"description": "Timeout duration to wait for consuming defined events (ISO 8601 duration format)",
"minLength": 1
}
},
"required": []
},
"stateDataFilter": {
"description": "State data filter",
"$ref": "#/definitions/statedatafilter"
},
"transition": {
"description": "Next transition of the workflow after all the actions have been performed",
"$ref": "#/definitions/transition"
},
"end": {
"$ref": "#/definitions/end",
"description": "State end definition"
},
"metadata": {
"$ref": "#/properties/metadata"
}
},
"additionalProperties": false,
"oneOf": [{
"required": ["name", "type", "onEvents", "end"]
}, {
"required": ["name", "type", "onEvents", "transition"]
}]
},
"operationstate": {
"type": "object",
"description": "Defines actions be performed. Does not wait for incoming events",
"properties": {
"name": {
"type": "string",
"description": "State name"
},
"type": {
"type": "string",
"const": "operation",
"description": "State type"
},
"end": {
"$ref": "#/definitions/end",
"description": "State end definition"
},
"stateDataFilter": {
"description": "State data filter",
"$ref": "#/definitions/statedatafilter"
},
"actionMode": {
"type": "string",
"enum": ["sequential", "parallel"],
"description": "Specifies whether actions are performed in sequence or in parallel",
"default": "sequential"
},
"actions": {
"type": "array",
"description": "Actions to be performed",
"items": {
"type": "object",
"$ref": "#/definitions/action"
}
},
"timeouts": {
"type": "object",
"description": "State specific timeouts",
"properties": {
"stateExecTimeout": {
"$ref": "#/definitions/eventstate/properties/timeouts/properties/stateExecTimeout"
},
"actionExecTimeout": {
"$ref": "#/definitions/branch/properties/timeouts/properties/actionExecTimeout"
}
},
"required": []
},
"transition": {
"description": "Next transition of the workflow after all the actions have been performed",
"$ref": "#/definitions/transition"
},
"metadata": {
"$ref": "#/properties/metadata"
}
},
"additionalProperties": false,
"oneOf": [{
"required": ["name", "type", "actions", "end"]
}, {
"required": ["name", "type", "actions", "transition"]
}]
},
"parallelstate": {
"type": "object",
"description": "Consists of a number of states that are executed in parallel",
"properties": {
"name": {
"type": "string",
"description": "State name"
},
"type": {
"type": "string",
"const": "parallel",
"description": "State type"
},
"end": {
"$ref": "#/definitions/end",
"description": "State end definition"
},
"stateDataFilter": {
"description": "State data filter",
"$ref": "#/definitions/statedatafilter"
},
"timeouts": {
"type": "object",
"description": "State specific timeouts",
"properties": {
"stateExecTimeout": {
"$ref": "#/definitions/eventstate/properties/timeouts/properties/stateExecTimeout"
},
"branchExecTimeout": {
"$ref": "#/definitions/branch/properties/timeouts/properties/branchExecTimeout"
}
},
"required": []
},
"branches": {
"type": "array",
"description": "Branch Definitions",
"items": {
"type": "object",
"$ref": "#/definitions/branch"
},
"additionalItems": false
},
"completionType": {
"type": "string",
"enum": ["allOf", "atLeast"],
"description": "Option types on how to complete branch execution.",
"default": "allOf"
},
"numCompleted": {
"type": ["number", "string"],
"minimum": 0,
"minLength": 0,
"description": "Used when completionType is set to 'atLeast' to specify the minimum number of branches that must complete before the state will transition."
},
"transition": {
"description": "Next transition of the workflow after all branches have completed execution",
"$ref": "#/definitions/transition"
},
"metadata": {
"$ref": "#/properties/metadata"
}
},
"additionalProperties": false,
"oneOf": [{
"required": ["name", "type", "branches", "end"]
}, {
"required": ["name", "type", "branches", "transition"]
}]
},
"switchstate": {
"type": "object",
"description": "Permits transitions to other states based on data conditions",
"properties": {
"name": {
"type": "string",
"description": "State name"
},
"type": {
"type": "string",
"const": "switch",
"description": "State type"
},
"stateDataFilter": {
"description": "State data filter",
"$ref": "#/definitions/statedatafilter"
},
"timeouts": {
"type": "object",
"description": "State specific timeouts",
"properties": {
"stateExecTimeout": {
"$ref": "#/definitions/eventstate/properties/timeouts/properties/stateExecTimeout"
}
},
"required": []
},
"dataConditions": {
"type": "array",
"description": "Defines conditions evaluated against state data",
"items": {
"type": "object",
"$ref": "#/definitions/datacondition"
},
"additionalItems": false
},
"defaultCondition": {
"description": "Default transition of the workflow if there is no matching data conditions. Can include a transition or end definition",
"$ref": "#/definitions/defaultconditiondef"
},
"metadata": {
"$ref": "#/properties/metadata"
}
},
"additionalProperties": false,
"required": ["name", "type", "dataConditions", "defaultCondition"]
},
"defaultconditiondef": {
"type": "object",
"description": "DefaultCondition definition. Can be either a transition or end definition",
"properties": {
"name": {
"type": "string",
"description": "The optional name of the default condition, used solely for display purposes"
},
"transition": {
"$ref": "#/definitions/transition"
},
"end": {
"$ref": "#/definitions/end"
}
},
"additionalProperties": false,
"oneOf": [{
"required": ["transition"]
}, {
"required": ["end"]
}]
},
"datacondition": {
"oneOf": [{
"$ref": "#/definitions/transitiondatacondition"
}, {
"$ref": "#/definitions/enddatacondition"
}]
},
"transitiondatacondition": {
"type": "object",
"description": "Switch state data based condition",
"properties": {
"name": {
"type": "string",
"description": "Data condition name"
},
"condition": {
"type": "string",
"description": "Workflow expression evaluated against state data. Must evaluate to true or false"
},
"transition": {
"description": "Workflow transition if condition is evaluated to true",
"$ref": "#/definitions/transition"
},
"metadata": {
"$ref": "#/properties/metadata"
}
},
"additionalProperties": false,
"required": ["condition", "transition"]
},
"enddatacondition": {
"type": "object",
"description": "Switch state data based condition",
"properties": {
"name": {
"type": "string",
"description": "Data condition name"
},
"condition": {
"type": "string",
"description": "Workflow expression evaluated against state data. Must evaluate to true or false"
},
"end": {
"$ref": "#/definitions/end",
"description": "Workflow end definition"
},
"metadata": {
"$ref": "#/properties/metadata"
}
},
"additionalProperties": false,
"required": ["condition", "end"]
},
"foreachstate": {
"type": "object",
"description": "Execute a set of defined actions or workflows for each element of a data array",
"properties": {
"name": {
"type": "string",
"description": "State name"
},
"type": {
"type": "string",
"const": "foreach",
"description": "State type"
},
"end": {
"$ref": "#/definitions/end",
"description": "State end definition"
},
"inputCollection": {
"type": "string",
"description": "Workflow expression selecting an array element of the states data"
},
"outputCollection": {
"type": "string",
"description": "Workflow expression specifying an array element of the states data to add the results of each iteration"
},
"iterationParam": {
"type": "string",
"description": "Name of the iteration parameter that can be referenced in actions/workflow. For each parallel iteration, this param should contain an unique element of the inputCollection array"
},
"batchSize": {
"type": ["number", "string"],
"minimum": 0,
"minLength": 0,
"description": "Specifies how many iterations may run in parallel at the same time. Used if 'mode' property is set to 'parallel' (default)"
},
"actions": {
"type": "array",
"description": "Actions to be executed for each of the elements of inputCollection",
"items": {
"type": "object",
"$ref": "#/definitions/action"
},
"additionalItems": false
},
"timeouts": {
"type": "object",
"description": "State specific timeouts",
"properties": {
"stateExecTimeout": {
"$ref": "#/definitions/eventstate/properties/timeouts/properties/stateExecTimeout"
},
"actionExecTimeout": {
"$ref": "#/definitions/branch/properties/timeouts/properties/actionExecTimeout"
}
},
"required": []
},
"stateDataFilter": {
"description": "State data filter",
"$ref": "#/definitions/statedatafilter"
},
"transition": {
"description": "Next transition of the workflow after state has completed",
"$ref": "#/definitions/transition"
},
"mode": {
"type": "string",
"enum": ["sequential", "parallel"],
"description": "Specifies how iterations are to be performed (sequentially or in parallel)",
"default": "parallel"
},
"metadata": {
"$ref": "#/properties/metadata"
}
},
"additionalProperties": false,
"oneOf": [{
"required": ["name", "type", "inputCollection", "actions", "end"]
}, {
"required": ["name", "type", "inputCollection", "actions", "transition"]
}]
},
"startdef": {
"type": "string",
"description": "Name of the starting workflow state",
"minLength": 1
},
"end": {
"oneOf": [{
"type": "boolean",
"description": "State end definition",
"default": true
}, {
"type": "object",
"description": "State end definition",
"properties": {
"terminate": {
"type": "boolean",
"default": false,
"description": "If true, completes all execution flows in the given workflow instance"
},
"produceEvents": {
"type": "array",
"description": "Defines events that should be produced",
"items": {
"type": "object",
"$ref": "#/definitions/produceeventdef"
},
"additionalItems": false
}
},
"additionalProperties": false,
"required": []
}]
},
"produceeventdef": {
"type": "object",
"description": "Produce an event and set its data",
"properties": {
"eventRef": {
"type": "string",
"description": "References a name of a defined event"
},
"data": {
"type": ["string", "object"],
"description": "If String, expression which selects parts of the states data output to become the data of the produced event. If object a custom object to become the data of produced event."
},
"contextAttributes": {
"type": "object",
"description": "Add additional event extension context attributes",
"additionalProperties": {
"type": "string"
}
}
},