-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNew document 2.json
2008 lines (2008 loc) · 57.2 KB
/
New document 2.json
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://serverlessworkflow.io/schemas/0.8/workflow.json",
"$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
},
"dataInputSchema": {
"oneOf": [
{
"type": "string",
"description": "URI of the JSON Schema used to validate the workflow data input",
"minLength": 1
},
{
"type": "object",
"description": "Workflow data input schema definition",
"properties": {
"schema": {
"type": "string",
"description": "URI of the JSON Schema used to validate the workflow data input",
"minLength": 1
},
"failOnValidationErrors": {
"type": "boolean",
"default": true,
"description": "Determines if workflow execution should continue if there are validation errors"
}
},
"additionalProperties": false,
"required": [
"schema",
"failOnValidationErrors"
]
}
]
},
"secrets": {
"$ref": "secrets.json#/secrets"
},
"constants": {
"oneOf": [
{
"type": "string",
"format": "uri",
"description": "URI to a resource containing constants data (json or yaml)"
},
{
"type": "object",
"description": "Workflow constants data (object type)"
}
]
},
"start": {
"$ref": "#/definitions/startdef"
},
"specVersion": {
"type": "string",
"description": "Serverless Workflow schema version",
"minLength": 1
},
"expressionLang": {
"type": "string",
"description": "Identifies the expression language used for workflow expressions. Default is 'jq'",
"default": "jq",
"minLength": 1
},
"timeouts": {
"$ref": "timeouts.json#/timeouts"
},
"errors": {
"$ref": "errors.json#/errors"
},
"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": {
"$ref": "common.json#/definitions/metadata"
},
"events": {
"$ref": "events.json#/events"
},
"functions": {
"$ref": "functions.json#/functions"
},
"autoRetries": {
"type": "boolean",
"default": false,
"description": "If set to true, actions should automatically be retried on unchecked errors. Default is false"
},
"retries": {
"$ref": "retries.json#/retries"
},
"auth": {
"$ref": "auth.json#/auth"
},
"states": {
"type": "array",
"description": "State definitions",
"items": {
"anyOf": [
{
"title": "Sleep State",
"$ref": "#/definitions/sleepstate"
},
{
"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": "Inject State",
"$ref": "#/definitions/injectstate"
},
{
"title": "ForEach State",
"$ref": "#/definitions/foreachstate"
},
{
"title": "Callback State",
"$ref": "#/definitions/callbackstate"
}
]
},
"additionalItems": false,
"minItems": 1
}
},
"oneOf": [
{
"required": [
"id",
"specVersion",
"states"
]
},
{
"required": [
"key",
"specVersion",
"states"
]
}
],
"definitions": {
"sleep": {
"type": "object",
"properties": {
"before": {
"type": "string",
"description": "Amount of time (ISO 8601 duration format) to sleep before function/subflow invocation. Does not apply if 'eventRef' is defined."
},
"after": {
"type": "string",
"description": "Amount of time (ISO 8601 duration format) to sleep after function/subflow invocation. Does not apply if 'eventRef' is defined."
}
},
"oneOf": [
{
"required": [
"before"
]
},
{
"required": [
"after"
]
},
{
"required": [
"before",
"after"
]
}
]
},
"crondef": {
"oneOf": [
{
"type": "string",
"description": "Cron expression defining when workflow instances should be created (automatically)",
"minLength": 1
},
{
"type": "object",
"properties": {
"expression": {
"type": "string",
"description": "Repeating interval (cron expression) describing when the workflow instance should be created",
"minLength": 1
},
"validUntil": {
"type": "string",
"description": "Specific date and time (ISO 8601 format) when the cron expression invocation is no longer valid"
}
},
"additionalProperties": false,
"required": [
"expression"
]
}
]
},
"continueasdef": {
"oneOf": [
{
"type": "string",
"description": "Unique id of the workflow to be continue execution as. Entire state data is passed as data input to next execution",
"minLength": 1
},
{
"type": "object",
"properties": {
"workflowId": {
"type": "string",
"description": "Unique id of the workflow to continue execution as"
},
"version": {
"type": "string",
"description": "Version of the workflow to continue execution as",
"minLength": 1
},
"data": {
"type": [
"string",
"object"
],
"description": "If string type, an expression which selects parts of the states data output to become the workflow data input of continued execution. If object type, a custom object to become the workflow data input of the continued execution"
},
"workflowExecTimeout": {
"$ref": "timeouts.json#/definitions/workflowExecTimeout",
"description": "Workflow execution timeout to be used by the workflow continuing execution. Overwrites any specific settings set by that workflow"
}
},
"required": [
"workflowId"
]
}
]
},
"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
},
"compensate": {
"type": "boolean",
"default": false,
"description": "If set to true, triggers workflow compensation when before this transition is taken. Default is false"
}
},
"additionalProperties": false,
"required": [
"nextState"
]
}
]
},
"error": {
"type": "object",
"properties": {
"errorRef": {
"type": "string",
"description": "Reference to a unique workflow error definition. Used of errorRefs is not used",
"minLength": 1
},
"errorRefs": {
"type": "array",
"description": "References one or more workflow error definitions. Used if errorRef is not used",
"minItems": 1,
"items": {
"type": "string"
},
"additionalItems": false
},
"transition": {
"description": "Transition to next state to handle the error.",
"$ref": "#/definitions/transition"
},
"end": {
"description": "End workflow execution in case of this error.",
"$ref": "#/definitions/end"
}
},
"additionalProperties": false,
"oneOf": [
{
"required": [
"errorRef",
"transition"
]
},
{
"required": [
"errorRef",
"end"
]
},
{
"required": [
"errorRefs",
"transition"
]
},
{
"required": [
"errorRefs",
"end"
]
}
]
},
"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": {
"id": {
"type": "string",
"description": "Unique action identifier"
},
"name": {
"type": "string",
"description": "Unique action definition name"
},
"functionRef": {
"description": "References a function to be invoked",
"$ref": "#/definitions/functionref"
},
"eventRef": {
"description": "References a 'trigger' and 'result' reusable event definitions",
"$ref": "#/definitions/eventref"
},
"subFlowRef": {
"description": "References a sub-workflow to invoke",
"$ref": "#/definitions/subflowref"
},
"sleep": {
"description": "Defines time periods workflow execution should sleep before / after function execution",
"$ref": "#/definitions/sleep"
},
"retryRef": {
"type": "string",
"description": "References a defined workflow retry definition. If not defined the default retry policy is assumed"
},
"nonRetryableErrors": {
"type": "array",
"description": "List of unique references to defined workflow errors for which the action should not be retried. Used only when `autoRetries` is set to `true`",
"minItems": 1,
"items": {
"type": "string"
},
"additionalItems": false
},
"retryableErrors": {
"type": "array",
"description": "List of unique references to defined workflow errors for which the action should be retried. Used only when `autoRetries` is set to `false`",
"minItems": 1,
"items": {
"type": "string"
},
"additionalItems": false
},
"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": {
"oneOf": [
{
"type": "string",
"description": "Name of the referenced function",
"minLength": 1
},
{
"type": "object",
"description": "Function Reference",
"properties": {
"refName": {
"type": "string",
"description": "Name of the referenced function"
},
"arguments": {
"type": "object",
"description": "Function arguments/inputs"
},
"selectionSet": {
"type": "string",
"description": "Only used if function type is 'graphql'. A string containing a valid GraphQL selection set"
},
"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": {
"triggerEventRef": {
"type": "string",
"description": "Reference to the unique name of a 'produced' event definition"
},
"resultEventRef": {
"type": "string",
"description": "Reference to the unique name of a 'consumed' event definition"
},
"resultEventTimeout": {
"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 'triggerEventRef'. If object type, a custom object to become the data (payload) of the event referenced by 'triggerEventRef'."
},
"contextAttributes": {
"type": "object",
"description": "Add additional extension context attributes to the produced event",
"additionalProperties": {
"type": "string"
}
},
"invoke": {
"type": "string",
"enum": [
"sync",
"async"
],
"description": "Specifies if the function should be invoked sync or async. Default is sync.",
"default": "sync"
}
},
"additionalProperties": false,
"required": [
"triggerEventRef",
"resultEventRef"
]
},
"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": {
"$ref": "timeouts.json#/definitions/actionExecTimeout"
},
"branchExecTimeout": {
"$ref": "timeouts.json#/definitions/branchExecTimeout"
}
},
"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"
]
},
"sleepstate": {
"type": "object",
"description": "Causes the workflow execution to sleep for a specified duration",
"properties": {
"id": {
"type": "string",
"description": "Unique State id",
"minLength": 1
},
"name": {
"type": "string",
"description": "State name"
},
"type": {
"type": "string",
"const": "sleep",
"description": "State type"
},
"end": {
"$ref": "#/definitions/end",
"description": "State end definition"
},
"stateDataFilter": {
"description": "State data filter",
"$ref": "#/definitions/statedatafilter"
},
"duration": {
"type": "string",
"description": "Duration (ISO 8601 duration format) to sleep"
},
"timeouts": {
"type": "object",
"description": "State specific timeouts",
"properties": {
"stateExecTimeout": {
"$ref": "timeouts.json#/definitions/stateExecTimeout"
}
},
"required": []
},
"onErrors": {
"type": "array",
"description": "States error handling definitions",
"items": {
"type": "object",
"$ref": "#/definitions/error"
},
"additionalItems": false
},
"transition": {
"description": "Next transition of the workflow after the workflow sleep",
"$ref": "#/definitions/transition"
},
"compensatedBy": {
"type": "string",
"minLength": 1,
"description": "Unique Name of a workflow state which is responsible for compensation of this state"
},
"usedForCompensation": {
"type": "boolean",
"default": false,
"description": "If true, this state is used to compensate another state. Default is false"
},
"metadata": {
"$ref": "common.json#/definitions/metadata"
}
},
"additionalProperties": false,
"if": {
"properties": {
"usedForCompensation": {
"const": true
}
},
"required": [
"usedForCompensation"
]
},
"then": {
"required": [
"name",
"type",
"duration"
]
},
"else": {
"oneOf": [
{
"required": [
"name",
"type",
"duration",
"end"
]
},
{
"required": [
"name",
"type",
"duration",
"transition"
]
}
]
}
},
"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": {
"id": {
"type": "string",
"description": "Unique State id",
"minLength": 1
},
"name": {
"type": "string",
"description": "State name"
},
"type": {
"type": "string",
"const": "event",
"description": "State type"
},
"exclusive": {
"type": "boolean",
"default": 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": {
"$ref": "timeouts.json#/definitions/stateExecTimeout"
},
"actionExecTimeout": {
"$ref": "timeouts.json#/definitions/actionExecTimeout"
},
"eventTimeout": {
"$ref": "timeouts.json#/definitions/eventTimeout"
}
},
"required": []
},
"stateDataFilter": {
"description": "State data filter",
"$ref": "#/definitions/statedatafilter"
},
"onErrors": {
"type": "array",
"description": "States error handling definitions",
"items": {
"type": "object",
"$ref": "#/definitions/error"
},
"additionalItems": false
},
"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"
},
"compensatedBy": {
"type": "string",
"minLength": 1,
"description": "Unique Name of a workflow state which is responsible for compensation of this state"
},
"metadata": {
"$ref": "common.json#/definitions/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": {
"id": {
"type": "string",
"description": "Unique State id",
"minLength": 1
},
"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": "timeouts.json#/definitions/stateExecTimeout"
},
"actionExecTimeout": {
"$ref": "timeouts.json#/definitions/actionExecTimeout"
}
},
"required": []
},
"onErrors": {
"type": "array",
"description": "States error handling definitions",
"items": {
"type": "object",
"$ref": "#/definitions/error"
},
"additionalItems": false
},
"transition": {
"description": "Next transition of the workflow after all the actions have been performed",
"$ref": "#/definitions/transition"
},
"compensatedBy": {
"type": "string",
"minLength": 1,
"description": "Unique Name of a workflow state which is responsible for compensation of this state"
},
"usedForCompensation": {
"type": "boolean",
"default": false,
"description": "If true, this state is used to compensate another state. Default is false"
},
"metadata": {
"$ref": "common.json#/definitions/metadata"
}
},
"additionalProperties": false,
"if": {
"properties": {
"usedForCompensation": {
"const": true
}
},
"required": [
"usedForCompensation"
]
},
"then": {
"required": [
"name",
"type",
"actions"
]
},
"else": {
"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": {
"id": {
"type": "string",
"description": "Unique State id",
"minLength": 1
},
"name": {