Skip to content

Commit bb5fa9f

Browse files
author
Tihomir Surdilovic
authored
Update to function and events definitions - allow inline array def as well as uri reference to external resource (#142)
Signed-off-by: Tihomir Surdilovic <[email protected]>
1 parent 54421ed commit bb5fa9f

File tree

4 files changed

+289
-112
lines changed

4 files changed

+289
-112
lines changed

schema/events.json

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@
33
"$schema": "http://json-schema.org/draft-07/schema#",
44
"description": "Serverless Workflow specification - events schema",
55
"type": "object",
6-
"definitions": {
7-
"events": {
8-
"type": "array",
9-
"description": "Workflow CloudEvent definitions. Defines CloudEvents that can be consumed or produced",
10-
"items": {
11-
"type": "object",
12-
"$ref": "#/definitions/eventdef"
13-
}
6+
"events": {
7+
"type": "array",
8+
"description": "Workflow CloudEvent definitions. Defines CloudEvents that can be consumed or produced",
9+
"items": {
10+
"type": "object",
11+
"$ref": "#/definitions/eventdef"
1412
},
13+
"minItems": 1
14+
},
15+
"required": [
16+
"events"
17+
],
18+
"definitions": {
1519
"eventdef": {
1620
"type": "object",
1721
"properties": {

schema/functions.json

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
"$schema": "http://json-schema.org/draft-07/schema#",
44
"description": "Serverless Workflow specification - functions schema",
55
"type": "object",
6-
"definitions": {
7-
"functions": {
8-
"type": "array",
9-
"description": "Workflow function definitions",
10-
"items": {
11-
"type": "object",
12-
"$ref": "#/definitions/function"
13-
},
14-
"minLength": 1
6+
"functions": {
7+
"type": "array",
8+
"description": "Workflow function definitions",
9+
"items": {
10+
"type": "object",
11+
"$ref": "#/definitions/function"
1512
},
13+
"minItems": 1
14+
},
15+
"required": [
16+
"functions"
17+
],
18+
"definitions": {
1619
"function": {
1720
"type": "object",
1821
"properties": {

schema/workflow.json

Lines changed: 188 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -3,96 +3,196 @@
33
"$schema": "http://json-schema.org/draft-07/schema#",
44
"description": "Serverless Workflow specification - workflow schema",
55
"type": "object",
6-
"properties": {
7-
"id": {
8-
"type": "string",
9-
"description": "Workflow unique identifier",
10-
"minLength": 1
11-
},
12-
"name": {
13-
"type": "string",
14-
"description": "Workflow name",
15-
"minLength": 1
16-
},
17-
"description": {
18-
"type": "string",
19-
"description": "Workflow description"
20-
},
21-
"version": {
22-
"type": "string",
23-
"description": "Workflow version",
24-
"minLength": 1
25-
},
26-
"schemaVersion": {
27-
"type": "string",
28-
"description": "Serverless Workflow schema version",
29-
"minLength": 1
30-
},
31-
"dataInputSchema": {
32-
"type": "string",
33-
"format": "uri",
34-
"description": "URI to JSON Schema that workflow data input adheres to"
35-
},
36-
"dataOutputSchema": {
37-
"type": "string",
38-
"format": "uri",
39-
"description": "URI to JSON Schema that workflow data output adheres to"
40-
},
41-
"metadata": {
42-
"$ref": "common.json#/definitions/metadata"
43-
},
44-
"events": {
45-
"$ref": "events.json#/definitions/events"
46-
},
47-
"functions": {
48-
"$ref": "functions.json#/definitions/functions"
49-
},
50-
"states": {
51-
"type": "array",
52-
"description": "State definitions",
53-
"items": {
54-
"anyOf": [
55-
{
56-
"title": "Delay State",
57-
"$ref": "#/definitions/delaystate"
58-
},
59-
{
60-
"title": "Event State",
61-
"$ref": "#/definitions/eventstate"
62-
},
63-
{
64-
"title": "Operation State",
65-
"$ref": "#/definitions/operationstate"
66-
},
67-
{
68-
"title": "Parallel State",
69-
"$ref": "#/definitions/parallelstate"
70-
},
71-
{
72-
"title": "Switch State",
73-
"$ref": "#/definitions/switchstate"
74-
},
75-
{
76-
"title": "SubFlow State",
77-
"$ref": "#/definitions/subflowstate"
78-
},
79-
{
80-
"title": "Inject State",
81-
"$ref": "#/definitions/injectstate"
6+
"oneOf": [
7+
{
8+
"properties": {
9+
"id": {
10+
"type": "string",
11+
"description": "Workflow unique identifier",
12+
"minLength": 1
13+
},
14+
"name": {
15+
"type": "string",
16+
"description": "Workflow name",
17+
"minLength": 1
18+
},
19+
"description": {
20+
"type": "string",
21+
"description": "Workflow description"
22+
},
23+
"version": {
24+
"type": "string",
25+
"description": "Workflow version",
26+
"minLength": 1
27+
},
28+
"schemaVersion": {
29+
"type": "string",
30+
"description": "Serverless Workflow schema version",
31+
"minLength": 1
32+
},
33+
"dataInputSchema": {
34+
"type": "string",
35+
"format": "uri",
36+
"description": "URI to JSON Schema that workflow data input adheres to"
37+
},
38+
"dataOutputSchema": {
39+
"type": "string",
40+
"format": "uri",
41+
"description": "URI to JSON Schema that workflow data output adheres to"
42+
},
43+
"metadata": {
44+
"$ref": "common.json#/definitions/metadata"
45+
},
46+
"events": {
47+
"$ref": "events.json#/events"
48+
},
49+
"functions": {
50+
"$ref": "functions.json#/functions"
51+
},
52+
"states": {
53+
"type": "array",
54+
"description": "State definitions",
55+
"items": {
56+
"anyOf": [
57+
{
58+
"title": "Delay State",
59+
"$ref": "#/definitions/delaystate"
60+
},
61+
{
62+
"title": "Event State",
63+
"$ref": "#/definitions/eventstate"
64+
},
65+
{
66+
"title": "Operation State",
67+
"$ref": "#/definitions/operationstate"
68+
},
69+
{
70+
"title": "Parallel State",
71+
"$ref": "#/definitions/parallelstate"
72+
},
73+
{
74+
"title": "Switch State",
75+
"$ref": "#/definitions/switchstate"
76+
},
77+
{
78+
"title": "SubFlow State",
79+
"$ref": "#/definitions/subflowstate"
80+
},
81+
{
82+
"title": "Inject State",
83+
"$ref": "#/definitions/injectstate"
84+
},
85+
{
86+
"title": "ForEach State",
87+
"$ref": "#/definitions/foreachstate"
88+
},
89+
{
90+
"title": "Callback State",
91+
"$ref": "#/definitions/callbackstate"
92+
}
93+
]
8294
},
83-
{
84-
"title": "ForEach State",
85-
"$ref": "#/definitions/foreachstate"
95+
"minItems": 1
96+
}
97+
}
98+
},
99+
{
100+
"properties": {
101+
"id": {
102+
"type": "string",
103+
"description": "Workflow unique identifier",
104+
"minLength": 1
105+
},
106+
"name": {
107+
"type": "string",
108+
"description": "Workflow name",
109+
"minLength": 1
110+
},
111+
"description": {
112+
"type": "string",
113+
"description": "Workflow description"
114+
},
115+
"version": {
116+
"type": "string",
117+
"description": "Workflow version",
118+
"minLength": 1
119+
},
120+
"schemaVersion": {
121+
"type": "string",
122+
"description": "Serverless Workflow schema version",
123+
"minLength": 1
124+
},
125+
"dataInputSchema": {
126+
"type": "string",
127+
"format": "uri",
128+
"description": "URI to JSON Schema that workflow data input adheres to"
129+
},
130+
"dataOutputSchema": {
131+
"type": "string",
132+
"format": "uri",
133+
"description": "URI to JSON Schema that workflow data output adheres to"
134+
},
135+
"metadata": {
136+
"$ref": "common.json#/definitions/metadata"
137+
},
138+
"events": {
139+
"type": "string",
140+
"format": "uri",
141+
"description": "URI to a resource containing event definitions (json or yaml)"
142+
},
143+
"functions": {
144+
"type": "string",
145+
"format": "uri",
146+
"description": "URI to a resource containing function definitions (json or yaml)"
147+
},
148+
"states": {
149+
"type": "array",
150+
"description": "State definitions",
151+
"items": {
152+
"anyOf": [
153+
{
154+
"title": "Delay State",
155+
"$ref": "#/definitions/delaystate"
156+
},
157+
{
158+
"title": "Event State",
159+
"$ref": "#/definitions/eventstate"
160+
},
161+
{
162+
"title": "Operation State",
163+
"$ref": "#/definitions/operationstate"
164+
},
165+
{
166+
"title": "Parallel State",
167+
"$ref": "#/definitions/parallelstate"
168+
},
169+
{
170+
"title": "Switch State",
171+
"$ref": "#/definitions/switchstate"
172+
},
173+
{
174+
"title": "SubFlow State",
175+
"$ref": "#/definitions/subflowstate"
176+
},
177+
{
178+
"title": "Inject State",
179+
"$ref": "#/definitions/injectstate"
180+
},
181+
{
182+
"title": "ForEach State",
183+
"$ref": "#/definitions/foreachstate"
184+
},
185+
{
186+
"title": "Callback State",
187+
"$ref": "#/definitions/callbackstate"
188+
}
189+
]
86190
},
87-
{
88-
"title": "Callback State",
89-
"$ref": "#/definitions/callbackstate"
90-
}
91-
]
92-
},
93-
"minLength": 1
191+
"minItems": 1
192+
}
193+
}
94194
}
95-
},
195+
],
96196
"required": [
97197
"id",
98198
"name",
@@ -1756,4 +1856,4 @@
17561856
"required": []
17571857
}
17581858
}
1759-
}
1859+
}

0 commit comments

Comments
 (0)