Skip to content

Commit ec945f7

Browse files
committed
feat: make bindingType fixed if unconditional versionTag is defined
1 parent af0e8bb commit ec945f7

File tree

7 files changed

+587
-2
lines changed

7 files changed

+587
-2
lines changed

packages/zeebe-element-templates-json-schema/src/defs/template/bindingType.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,15 @@
123123
},
124124
"value": {
125125
"const": "versionTag"
126+
},
127+
"type": {
128+
"const": "Hidden"
126129
}
127130
},
128131
"required": [
129132
"binding",
130-
"value"
133+
"value",
134+
"type"
131135
]
132136
}
133137
}
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
export const template = {
2+
'$schema': 'https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json',
3+
'name': 'Reusable Rule Template',
4+
'id': 'io.camunda.examples.Decision',
5+
'description': 'A reusable rule template',
6+
'version': 1,
7+
'engines': {
8+
'camunda': '^8.6'
9+
},
10+
'appliesTo': [
11+
'bpmn:Task',
12+
'bpmn:BusinessRuleTask'
13+
],
14+
'elementType': {
15+
'value': 'bpmn:BusinessRuleTask'
16+
},
17+
'properties': [
18+
{
19+
'type': 'Hidden',
20+
'value': 'aReusableRule',
21+
'binding': {
22+
'type': 'zeebe:calledDecision',
23+
'property': 'decisionId'
24+
}
25+
},
26+
{
27+
'type': 'Hidden',
28+
'value': 'aResultVariable',
29+
'binding': {
30+
'type': 'zeebe:calledDecision',
31+
'property': 'resultVariable'
32+
}
33+
},
34+
{
35+
'type': 'Dropdown',
36+
'value': 'versionTag',
37+
'choices': [
38+
{
39+
'name': 'versionTag',
40+
'value': 'versionTag'
41+
},
42+
{
43+
'name': 'deployment',
44+
'value': 'deployment'
45+
}
46+
],
47+
'binding': {
48+
'type': 'zeebe:calledDecision',
49+
'property': 'bindingType'
50+
}
51+
},
52+
{
53+
'type': 'String',
54+
'value': 'vers-1',
55+
'binding': {
56+
'type': 'zeebe:calledDecision',
57+
'property': 'versionTag'
58+
}
59+
}
60+
]
61+
};
62+
63+
export const errors = [
64+
{
65+
keyword: 'errorMessage',
66+
dataPath: '/properties',
67+
schemaPath: '#/allOf/1/allOf/7/allOf/1/then/properties/properties/errorMessage',
68+
params: {
69+
errors: [
70+
{
71+
keyword: 'const',
72+
dataPath: '/properties/0/binding/property',
73+
schemaPath: '#/allOf/1/allOf/7/allOf/1/then/properties/properties/contains/properties/binding/properties/property/const',
74+
params: {
75+
allowedValue: 'bindingType'
76+
},
77+
message: 'should be equal to constant',
78+
emUsed: true
79+
},
80+
{
81+
keyword: 'const',
82+
dataPath: '/properties/0/value',
83+
schemaPath: '#/allOf/1/allOf/7/allOf/1/then/properties/properties/contains/properties/value/const',
84+
params: {
85+
allowedValue: 'versionTag'
86+
},
87+
message: 'should be equal to constant',
88+
emUsed: true
89+
},
90+
{
91+
keyword: 'const',
92+
dataPath: '/properties/1/binding/property',
93+
schemaPath: '#/allOf/1/allOf/7/allOf/1/then/properties/properties/contains/properties/binding/properties/property/const',
94+
params: {
95+
allowedValue: 'bindingType'
96+
},
97+
message: 'should be equal to constant',
98+
emUsed: true
99+
},
100+
{
101+
keyword: 'const',
102+
dataPath: '/properties/1/value',
103+
schemaPath: '#/allOf/1/allOf/7/allOf/1/then/properties/properties/contains/properties/value/const',
104+
params: {
105+
allowedValue: 'versionTag'
106+
},
107+
message: 'should be equal to constant',
108+
emUsed: true
109+
},
110+
{
111+
keyword: 'const',
112+
dataPath: '/properties/2/type',
113+
schemaPath: '#/allOf/1/allOf/7/allOf/1/then/properties/properties/contains/properties/type/const',
114+
params: {
115+
allowedValue: 'Hidden'
116+
},
117+
message: 'should be equal to constant',
118+
emUsed: true
119+
},
120+
{
121+
keyword: 'const',
122+
dataPath: '/properties/3/binding/property',
123+
schemaPath: '#/allOf/1/allOf/7/allOf/1/then/properties/properties/contains/properties/binding/properties/property/const',
124+
params: {
125+
allowedValue: 'bindingType'
126+
},
127+
message: 'should be equal to constant',
128+
emUsed: true
129+
},
130+
{
131+
keyword: 'const',
132+
dataPath: '/properties/3/value',
133+
schemaPath: '#/allOf/1/allOf/7/allOf/1/then/properties/properties/contains/properties/value/const',
134+
params: {
135+
allowedValue: 'versionTag'
136+
},
137+
message: 'should be equal to constant',
138+
emUsed: true
139+
},
140+
{
141+
keyword: 'const',
142+
dataPath: '/properties/3/type',
143+
schemaPath: '#/allOf/1/allOf/7/allOf/1/then/properties/properties/contains/properties/type/const',
144+
params: {
145+
allowedValue: 'Hidden'
146+
},
147+
message: 'should be equal to constant',
148+
emUsed: true
149+
},
150+
{
151+
keyword: 'contains',
152+
dataPath: '/properties',
153+
schemaPath: '#/allOf/1/allOf/7/allOf/1/then/properties/properties/contains',
154+
params: {
155+
minContains: 1
156+
},
157+
message: 'should contain at least 1 valid item(s)',
158+
emUsed: true
159+
}
160+
]
161+
},
162+
message: 'Binding with property=`bindingType` and value=`versionTag` must be set when using a binding with property=`versionTag`'
163+
},
164+
{
165+
keyword: 'if',
166+
dataPath: '',
167+
schemaPath: '#/allOf/1/allOf/7/allOf/1/if',
168+
params: {
169+
failingKeyword: 'then'
170+
},
171+
message: 'should match "then" schema'
172+
},
173+
{
174+
keyword: 'type',
175+
dataPath: '',
176+
schemaPath: '#/oneOf/1/type',
177+
params: {
178+
type: 'array'
179+
},
180+
message: 'should be array'
181+
},
182+
{
183+
keyword: 'oneOf',
184+
dataPath: '',
185+
schemaPath: '#/oneOf',
186+
params: {
187+
passingSchemas: null
188+
},
189+
message: 'should match exactly one schema in oneOf'
190+
}
191+
];

packages/zeebe-element-templates-json-schema/test/fixtures/binding-type/called-element/missing-property-binding-type.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ export const errors = [
6464
message: "should have required property 'property'",
6565
emUsed: true
6666
},
67+
{
68+
dataPath: '/properties/0/type',
69+
emUsed: true,
70+
keyword: 'const',
71+
message: 'should be equal to constant',
72+
params: {
73+
allowedValue: 'Hidden'
74+
},
75+
schemaPath: '#/allOf/1/allOf/7/allOf/1/then/properties/properties/contains/properties/type/const'
76+
},
6777
{
6878
keyword: 'const',
6979
dataPath: '/properties/1/binding/property',

0 commit comments

Comments
 (0)