Skip to content

Commit 04d3835

Browse files
feat: support custom category (#168)
Related to camunda/camunda-modeler#5036
1 parent c25f00b commit 04d3835

File tree

6 files changed

+136
-1
lines changed

6 files changed

+136
-1
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$id": "#/category",
3+
"type": "object",
4+
"description": "A custom category to semantically group element templates",
5+
"default": {},
6+
"example": {
7+
"id": "custom-category",
8+
"name": "Custom Category"
9+
},
10+
"properties": {
11+
"id": {
12+
"$id": "#/category/id",
13+
"type": "string",
14+
"description": "The unique identifier of the category."
15+
},
16+
"name": {
17+
"$id": "#/category/name",
18+
"type": "string",
19+
"description": "The name of the category."
20+
}
21+
},
22+
"required": [
23+
"id",
24+
"name"
25+
]
26+
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
"engines": {
3232
"$ref": "src/defs/engines.json"
3333
},
34+
"category": {
35+
"$ref": "src/defs/category.json"
36+
},
3437
"icon": {
3538
"$ref": "src/defs/icon.json"
3639
},
@@ -42,7 +45,7 @@
4245
]
4346
},
4447
"groups": {
45-
"$ref": "src/defs/groups.json"
48+
"$ref": "src/defs/groups.json"
4649
}
4750
}
4851
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
export const template = {
2+
name: 'Category',
3+
id: 'example.com.category',
4+
appliesTo: [
5+
'bpmn:Task'
6+
],
7+
properties: [],
8+
category: {
9+
id: 'my-task'
10+
}
11+
};
12+
13+
export const errors = [
14+
{
15+
'keyword': 'required',
16+
'dataPath': '/category',
17+
'schemaPath': '#/properties/category/required',
18+
'params': {
19+
'missingProperty': 'name'
20+
},
21+
'message': "should have required property 'name'"
22+
},
23+
{
24+
'keyword': 'type',
25+
'dataPath': '',
26+
'schemaPath': '#/oneOf/1/type',
27+
'params': {
28+
'type': 'array'
29+
},
30+
'message': 'should be array'
31+
},
32+
{
33+
'keyword': 'oneOf',
34+
'dataPath': '',
35+
'schemaPath': '#/oneOf',
36+
'params': {
37+
'passingSchemas': null
38+
},
39+
'message': 'should match exactly one schema in oneOf'
40+
}
41+
];
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
export const template = {
2+
name: 'Category',
3+
id: 'example.com.category',
4+
appliesTo: [
5+
'bpmn:Task'
6+
],
7+
properties: [],
8+
category: {
9+
name: 'My task'
10+
}
11+
};
12+
13+
export const errors = [
14+
{
15+
'keyword': 'required',
16+
'dataPath': '/category',
17+
'schemaPath': '#/properties/category/required',
18+
'params': {
19+
'missingProperty': 'id'
20+
},
21+
'message': "should have required property 'id'"
22+
},
23+
{
24+
'keyword': 'type',
25+
'dataPath': '',
26+
'schemaPath': '#/oneOf/1/type',
27+
'params': {
28+
'type': 'array'
29+
},
30+
'message': 'should be array'
31+
},
32+
{
33+
'keyword': 'oneOf',
34+
'dataPath': '',
35+
'schemaPath': '#/oneOf',
36+
'params': {
37+
'passingSchemas': null
38+
},
39+
'message': 'should match exactly one schema in oneOf'
40+
}
41+
];
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export const template = {
2+
name: 'Category',
3+
id: 'example.com.category',
4+
appliesTo: [
5+
'bpmn:Task'
6+
],
7+
properties: [],
8+
category: {
9+
id: 'my-task',
10+
name: 'My task'
11+
}
12+
};
13+
14+
export const errors = null;

packages/zeebe-element-templates-json-schema/test/spec/validationSpec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,16 @@ describe('validation', function() {
253253
});
254254

255255

256+
describe('categories', function() {
257+
258+
it('category');
259+
260+
it('category-only-id');
261+
262+
it('category-only-name');
263+
});
264+
265+
256266
describe('icons', function() {
257267

258268
it('icon');

0 commit comments

Comments
 (0)