Skip to content

Commit 703c30a

Browse files
committed
fix(zeebe): require "feel":"optional/static" for Boolean/Number I/O
1 parent a915ae9 commit 703c30a

File tree

3 files changed

+89
-41
lines changed

3 files changed

+89
-41
lines changed

packages/zeebe-element-templates-json-schema/src/defs/properties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@
340340
"required": ["feel"],
341341
"properties": {
342342
"feel": {
343-
"const": "static"
343+
"enum": [ "optional", "static" ]
344344
}
345345
}
346346
}

packages/zeebe-element-templates-json-schema/test/fixtures/invalid-zeebe-input-feel.js

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,38 @@ export const template = {
66
],
77
'properties': [
88
{
9-
'label': 'booleanValid',
9+
'label': 'booleanValidOptional',
1010
'type': 'Boolean',
1111
'binding': {
1212
'type': 'zeebe:input',
13-
'name': 'booleanValid'
13+
'name': 'booleanValidOptional'
14+
},
15+
'feel': 'optional'
16+
},
17+
{
18+
'label': 'numberValidOptional',
19+
'type': 'Number',
20+
'binding': {
21+
'type': 'zeebe:input',
22+
'name': 'numberValidOptional'
23+
},
24+
'feel': 'optional'
25+
},
26+
{
27+
'label': 'booleanValidStatic',
28+
'type': 'Boolean',
29+
'binding': {
30+
'type': 'zeebe:input',
31+
'name': 'booleanValidStatic'
1432
},
1533
'feel': 'static'
1634
},
1735
{
18-
'label': 'numberValid',
36+
'label': 'numberValidStatic',
1937
'type': 'Number',
2038
'binding': {
2139
'type': 'zeebe:input',
22-
'name': 'numberValid'
40+
'name': 'numberValidStatic'
2341
},
2442
'feel': 'static'
2543
},
@@ -62,7 +80,7 @@ export const template = {
6280

6381
export const errors = [
6482
{
65-
'dataPath': '/properties/2',
83+
'dataPath': '/properties/4',
6684
'keyword': 'required',
6785
'message': 'should have required property \'feel\'',
6886
'params': {
@@ -71,7 +89,7 @@ export const errors = [
7189
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/required'
7290
},
7391
{
74-
'dataPath': '/properties/2',
92+
'dataPath': '/properties/4',
7593
'keyword': 'if',
7694
'message': 'should match "then" schema',
7795
'params': {
@@ -80,7 +98,7 @@ export const errors = [
8098
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/if'
8199
},
82100
{
83-
'dataPath': '/properties/3',
101+
'dataPath': '/properties/5',
84102
'keyword': 'required',
85103
'message': 'should have required property \'feel\'',
86104
'params': {
@@ -89,7 +107,7 @@ export const errors = [
89107
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/required'
90108
},
91109
{
92-
'dataPath': '/properties/3',
110+
'dataPath': '/properties/5',
93111
'keyword': 'if',
94112
'message': 'should match "then" schema',
95113
'params': {
@@ -98,16 +116,19 @@ export const errors = [
98116
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/if'
99117
},
100118
{
101-
'dataPath': '/properties/4/feel',
102-
'keyword': 'const',
103-
'message': 'should be equal to constant',
119+
'dataPath': '/properties/6/feel',
120+
'keyword': 'enum',
121+
'message': 'should be equal to one of the allowed values',
104122
'params': {
105-
'allowedValue': 'static'
123+
'allowedValues': [
124+
'optional',
125+
'static'
126+
]
106127
},
107-
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/properties/feel/const'
128+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/properties/feel/enum'
108129
},
109130
{
110-
'dataPath': '/properties/4',
131+
'dataPath': '/properties/6',
111132
'keyword': 'if',
112133
'message': 'should match "then" schema',
113134
'params': {
@@ -116,16 +137,19 @@ export const errors = [
116137
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/if'
117138
},
118139
{
119-
'dataPath': '/properties/5/feel',
120-
'keyword': 'const',
121-
'message': 'should be equal to constant',
140+
'dataPath': '/properties/7/feel',
141+
'keyword': 'enum',
142+
'message': 'should be equal to one of the allowed values',
122143
'params': {
123-
'allowedValue': 'static'
144+
'allowedValues': [
145+
'optional',
146+
'static'
147+
]
124148
},
125-
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/properties/feel/const'
149+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/properties/feel/enum'
126150
},
127151
{
128-
'dataPath': '/properties/5',
152+
'dataPath': '/properties/7',
129153
'keyword': 'if',
130154
'message': 'should match "then" schema',
131155
'params': {

packages/zeebe-element-templates-json-schema/test/fixtures/invalid-zeebe-output-feel.js

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,38 @@ export const template = {
66
],
77
'properties': [
88
{
9-
'label': 'booleanValid',
9+
'label': 'booleanValidOptional',
1010
'type': 'Boolean',
1111
'binding': {
1212
'type': 'zeebe:output',
13-
'source': 'booleanValid'
13+
'source': 'booleanValidOptional'
14+
},
15+
'feel': 'optional'
16+
},
17+
{
18+
'label': 'numberValidOptional',
19+
'type': 'Number',
20+
'binding': {
21+
'type': 'zeebe:output',
22+
'source': 'numberValidOptional'
23+
},
24+
'feel': 'optional'
25+
},
26+
{
27+
'label': 'booleanValidStatic',
28+
'type': 'Boolean',
29+
'binding': {
30+
'type': 'zeebe:output',
31+
'source': 'booleanValidStatic'
1432
},
1533
'feel': 'static'
1634
},
1735
{
18-
'label': 'numberValid',
36+
'label': 'numberValidStatic',
1937
'type': 'Number',
2038
'binding': {
2139
'type': 'zeebe:output',
22-
'source': 'numberValid'
40+
'source': 'numberValidStatic'
2341
},
2442
'feel': 'static'
2543
},
@@ -62,7 +80,7 @@ export const template = {
6280

6381
export const errors = [
6482
{
65-
'dataPath': '/properties/2',
83+
'dataPath': '/properties/4',
6684
'keyword': 'required',
6785
'message': 'should have required property \'feel\'',
6886
'params': {
@@ -71,7 +89,7 @@ export const errors = [
7189
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/required'
7290
},
7391
{
74-
'dataPath': '/properties/2',
92+
'dataPath': '/properties/4',
7593
'keyword': 'if',
7694
'message': 'should match "then" schema',
7795
'params': {
@@ -80,7 +98,7 @@ export const errors = [
8098
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/if'
8199
},
82100
{
83-
'dataPath': '/properties/3',
101+
'dataPath': '/properties/5',
84102
'keyword': 'required',
85103
'message': 'should have required property \'feel\'',
86104
'params': {
@@ -89,7 +107,7 @@ export const errors = [
89107
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/required'
90108
},
91109
{
92-
'dataPath': '/properties/3',
110+
'dataPath': '/properties/5',
93111
'keyword': 'if',
94112
'message': 'should match "then" schema',
95113
'params': {
@@ -98,16 +116,19 @@ export const errors = [
98116
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/if'
99117
},
100118
{
101-
'dataPath': '/properties/4/feel',
102-
'keyword': 'const',
103-
'message': 'should be equal to constant',
119+
'dataPath': '/properties/6/feel',
120+
'keyword': 'enum',
121+
'message': 'should be equal to one of the allowed values',
104122
'params': {
105-
'allowedValue': 'static'
123+
'allowedValues': [
124+
'optional',
125+
'static'
126+
]
106127
},
107-
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/properties/feel/const'
128+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/properties/feel/enum'
108129
},
109130
{
110-
'dataPath': '/properties/4',
131+
'dataPath': '/properties/6',
111132
'keyword': 'if',
112133
'message': 'should match "then" schema',
113134
'params': {
@@ -116,16 +137,19 @@ export const errors = [
116137
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/if'
117138
},
118139
{
119-
'dataPath': '/properties/5/feel',
120-
'keyword': 'const',
121-
'message': 'should be equal to constant',
140+
'dataPath': '/properties/7/feel',
141+
'keyword': 'enum',
142+
'message': 'should be equal to one of the allowed values',
122143
'params': {
123-
'allowedValue': 'static'
144+
'allowedValues': [
145+
'optional',
146+
'static'
147+
]
124148
},
125-
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/properties/feel/const'
149+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/properties/feel/enum'
126150
},
127151
{
128-
'dataPath': '/properties/5',
152+
'dataPath': '/properties/7',
129153
'keyword': 'if',
130154
'message': 'should match "then" schema',
131155
'params': {

0 commit comments

Comments
 (0)