bpmnlint-plugin-camunda-compat 0.6.3 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,9 +6,26 @@ All notable changes to [bpmnlint-plugin-camunda-compat](https://github.com/camun
6
6
 
7
7
  ___Note:__ Yet to be released changes appear here._
8
8
 
9
- ## 0.6.3
9
+ ## 0.8.0
10
10
 
11
- * `FIX`: backport of ([#34](https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/34)) to v0.6
11
+ * `FEAT`: add templates rule ([#31](https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/31))
12
+
13
+ ## 0.7.1
14
+
15
+ * `FIX`: lint subscription only if start event child of sub process ([#34](https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/34))
16
+
17
+ ## 0.7.0
18
+
19
+ * `FEAT`: refactor plugin structure ([#29](https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/29))
20
+ * `DEPS`: update to `bpmnlint@7.8.0` ([#29](https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/29))
21
+
22
+ ### Breaking Changes
23
+
24
+ * configuration not selected based on execution platform and version anymore, either configure manually or use [`@camunda/linting`](https://github.com/camunda/linting)
25
+ * error message not adjusted to be shown in Camunda Modeler anymore
26
+ * error type ELEMENT_TYPE changed to ELEMENT_TYPE_NOT_ALLOWED
27
+ * error type PROPERTY_TYPE changed to PROPERTY_TYPE_NOT_ALLOWED
28
+ * error data changed (cf. docs/ERRORS.md)
12
29
 
13
30
  ## 0.6.2
14
31
 
package/README.md CHANGED
@@ -2,25 +2,24 @@
2
2
 
3
3
  [![CI](https://github.com/camunda/bpmnlint-plugin-camunda-compat/workflows/CI/badge.svg)](https://github.com/camunda/bpmnlint-plugin-camunda-compat/actions?query=workflow%3ACI)
4
4
 
5
- Camunda BPMN compatibility, packed as a [bpmnlint](https://github.com/bpmn-io/bpmnlint) plug-in.
5
+ Camunda BPMN compatibility provided as a [bpmnlint](https://github.com/bpmn-io/bpmnlint) plug-in.
6
6
 
7
7
 
8
8
  ## Usage
9
9
 
10
- Add the plug-in via your `.bpmnlintrc` file:
10
+ To configure the linter dynamically based on the [execution platform and version](https://github.com/camunda/modeler-moddle), use [`@camunda/linting`](https://github.com/camunda/linting).
11
+
12
+ To configure the linter statically, add the configuration corresponding to your execution platform and version to your `.bpmnlintrc` file:
11
13
 
12
14
  ```
13
15
  {
14
16
  "extends": [
15
17
  "bpmnlint:recommended",
16
- "plugin:camunda-compat/recommended"
18
+ "plugin:camunda-compat/camunda-cloud-8-0"
17
19
  ]
18
20
  }
19
21
  ```
20
22
 
21
- To validate a diagram it must be pinned to a particular execution platform via the [`modeler`](https://github.com/camunda/modeler-moddle) BPMN 2.0 extension.
22
-
23
-
24
23
  ## Resources
25
24
 
26
25
  * [Issues](https://github.com/camunda/bpmnlint-plugin-camunda-compat/issues)
package/index.js CHANGED
@@ -1,43 +1,65 @@
1
+ const calledDecisionOrTaskDefinitionConfig = require('./rules/called-decision-or-task-definition/config'),
2
+ elementTypeConfig = require('./rules/element-type/config');
3
+
1
4
  module.exports = {
2
5
  configs: {
3
- all: {
6
+ 'camunda-cloud-1-0': {
4
7
  rules: {
5
- 'camunda-cloud-1-0': 'error',
6
- 'camunda-cloud-1-1': 'error',
7
- 'camunda-cloud-1-2': 'error',
8
- 'camunda-cloud-1-3': 'error',
9
- 'camunda-cloud-8-0': 'error',
10
- 'camunda-platform-7-15': 'error',
11
- 'camunda-platform-7-16': 'error',
12
- 'camunda-platform-7-17': 'error'
8
+ 'called-decision-or-task-definition': [ 'error', calledDecisionOrTaskDefinitionConfig.camundaCloud10 ],
9
+ 'called-element': 'error',
10
+ 'element-type': [ 'error', elementTypeConfig.camundaCloud10 ],
11
+ 'error-reference': 'error',
12
+ 'loop-characteristics': 'error',
13
+ 'message-reference': 'error',
14
+ 'no-template': 'error',
15
+ 'subscription': 'error'
13
16
  }
14
17
  },
15
- recommended: {
18
+ 'camunda-cloud-1-1': {
16
19
  rules: {
17
- 'camunda-cloud-1-0': 'error',
18
- 'camunda-cloud-1-1': 'error',
19
- 'camunda-cloud-1-2': 'error',
20
- 'camunda-cloud-1-3': 'error',
21
- 'camunda-cloud-8-0': 'error',
22
- 'camunda-platform-7-15': 'error',
23
- 'camunda-platform-7-16': 'error',
24
- 'camunda-platform-7-17': 'error'
20
+ 'called-decision-or-task-definition': [ 'error', calledDecisionOrTaskDefinitionConfig.camundaCloud11 ],
21
+ 'called-element': 'error',
22
+ 'element-type': [ 'error', elementTypeConfig.camundaCloud11 ],
23
+ 'error-reference': 'error',
24
+ 'loop-characteristics': 'error',
25
+ 'message-reference': 'error',
26
+ 'no-template': 'error',
27
+ 'subscription': 'error'
25
28
  }
26
29
  },
27
- cloud: {
30
+ 'camunda-cloud-1-2': {
28
31
  rules: {
29
- 'camunda-cloud-1-0': 'error',
30
- 'camunda-cloud-1-1': 'error',
31
- 'camunda-cloud-1-2': 'error',
32
- 'camunda-cloud-1-3': 'error',
33
- 'camunda-cloud-8-0': 'error'
32
+ 'called-decision-or-task-definition': [ 'error', calledDecisionOrTaskDefinitionConfig.camundaCloud12 ],
33
+ 'called-element': 'error',
34
+ 'element-type': [ 'error', elementTypeConfig.camundaCloud12 ],
35
+ 'error-reference': 'error',
36
+ 'loop-characteristics': 'error',
37
+ 'message-reference': 'error',
38
+ 'no-template': 'error',
39
+ 'subscription': 'error'
34
40
  }
35
41
  },
36
- platform: {
42
+ 'camunda-cloud-1-3': {
37
43
  rules: {
38
- 'camunda-platform-7-15': 'error',
39
- 'camunda-platform-7-16': 'error',
40
- 'camunda-platform-7-17': 'error'
44
+ 'called-decision-or-task-definition': [ 'error', calledDecisionOrTaskDefinitionConfig.camundaCloud13 ],
45
+ 'called-element': 'error',
46
+ 'element-type': [ 'error', elementTypeConfig.camundaCloud12 ],
47
+ 'error-reference': 'error',
48
+ 'loop-characteristics': 'error',
49
+ 'message-reference': 'error',
50
+ 'no-template': 'error',
51
+ 'subscription': 'error'
52
+ }
53
+ },
54
+ 'camunda-cloud-8-0': {
55
+ rules: {
56
+ 'called-decision-or-task-definition': [ 'error', calledDecisionOrTaskDefinitionConfig.camundaCloud13 ],
57
+ 'called-element': 'error',
58
+ 'element-type': [ 'error', elementTypeConfig.camundaCloud12 ],
59
+ 'error-reference': 'error',
60
+ 'loop-characteristics': 'error',
61
+ 'message-reference': 'error',
62
+ 'subscription': 'error'
41
63
  }
42
64
  }
43
65
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bpmnlint-plugin-camunda-compat",
3
- "version": "0.6.3",
4
- "description": "A bpmnlint plug-in for Camunda Cloud and Platform compatibility",
3
+ "version": "0.8.0",
4
+ "description": "A bpmnlint plug-in for Camunda Platform compatibility",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "all": "npm run lint && npm test",
@@ -24,8 +24,7 @@
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
26
  "bpmn-moddle": "^7.1.2",
27
- "bpmnlint": "^7.6.0",
28
- "camunda-bpmn-moddle": "^6.1.1",
27
+ "bpmnlint": "^7.8.0",
29
28
  "chai": "^4.3.5",
30
29
  "eslint": "^7.32.0",
31
30
  "eslint-plugin-bpmn-io": "^0.13.0",
@@ -33,7 +32,7 @@
33
32
  "modeler-moddle": "^0.1.0",
34
33
  "sinon": "^13.0.1",
35
34
  "sinon-chai": "^3.7.0",
36
- "zeebe-bpmn-moddle": "^0.10.0"
35
+ "zeebe-bpmn-moddle": "^0.12.1"
37
36
  },
38
37
  "dependencies": {
39
38
  "@philippfromme/moddle-helpers": "^0.1.0",
@@ -0,0 +1,36 @@
1
+ module.exports = {
2
+ camundaCloud10: {
3
+ elementsTaskDefinition: [
4
+ 'bpmn:ServiceTask'
5
+ ]
6
+ },
7
+ camundaCloud11: {
8
+ elementsTaskDefinition: [
9
+ 'bpmn:BusinessRuleTask',
10
+ 'bpmn:ServiceTask',
11
+ 'bpmn:ScriptTask',
12
+ 'bpmn:SendTask'
13
+ ]
14
+ },
15
+ camundaCloud12: {
16
+ elementsTaskDefinition: [
17
+ 'bpmn:BusinessRuleTask',
18
+ 'bpmn:IntermediateThrowEvent',
19
+ 'bpmn:ServiceTask',
20
+ 'bpmn:ScriptTask',
21
+ 'bpmn:SendTask'
22
+ ]
23
+ },
24
+ camundaCloud13: {
25
+ elementsCalledDecision: [
26
+ 'bpmn:BusinessRuleTask'
27
+ ],
28
+ elementsTaskDefinition: [
29
+ 'bpmn:BusinessRuleTask',
30
+ 'bpmn:IntermediateThrowEvent',
31
+ 'bpmn:ServiceTask',
32
+ 'bpmn:ScriptTask',
33
+ 'bpmn:SendTask'
34
+ ]
35
+ }
36
+ };
@@ -0,0 +1,122 @@
1
+ const {
2
+ is,
3
+ isAny
4
+ } = require('bpmnlint-utils');
5
+
6
+ const { getPath } = require('@philippfromme/moddle-helpers');
7
+
8
+ const {
9
+ findExtensionElement,
10
+ getEventDefinition,
11
+ hasProperties,
12
+ hasExtensionElementOfType,
13
+ hasExtensionElementsOfTypes
14
+ } = require('../utils/element');
15
+
16
+ const { reportErrors } = require('../utils/reporter');
17
+
18
+ const { ERROR_TYPES } = require('../utils/error-types');
19
+
20
+ module.exports = function(config) {
21
+ const {
22
+ elementsCalledDecision = [],
23
+ elementsTaskDefinition = []
24
+ } = config;
25
+
26
+ function check(node, reporter) {
27
+ if (!isAny(node, elementsCalledDecision) && !isAny(node, elementsTaskDefinition)) {
28
+ return;
29
+ }
30
+
31
+ if (is(node, 'bpmn:ThrowEvent') && !getEventDefinition(node)) {
32
+ return;
33
+ }
34
+
35
+ let errors;
36
+
37
+ const calledDecision = findExtensionElement(node, 'zeebe:CalledDecision'),
38
+ taskDefinition = findExtensionElement(node, 'zeebe:TaskDefinition');
39
+
40
+ if (calledDecision && !taskDefinition) {
41
+
42
+ if (!isAny(node, elementsCalledDecision)) {
43
+ reportErrors(node, reporter, {
44
+ message: 'Extension element of type <zeebe:CalledDecision> not allowed',
45
+ path: getPath(calledDecision, node),
46
+ error: {
47
+ type: ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED,
48
+ node,
49
+ parentNode: null,
50
+ extensionElement: calledDecision
51
+ }
52
+ });
53
+
54
+ return;
55
+ }
56
+
57
+ errors = hasProperties(calledDecision, {
58
+ decisionId: {
59
+ required: true
60
+ },
61
+ resultVariable: {
62
+ required: true
63
+ }
64
+ }, node);
65
+
66
+ if (errors && errors.length) {
67
+ reportErrors(node, reporter, errors);
68
+
69
+ return;
70
+ }
71
+ }
72
+
73
+ if (!calledDecision && taskDefinition) {
74
+
75
+ if (!isAny(node, elementsTaskDefinition)) {
76
+ reportErrors(node, reporter, {
77
+ message: 'Extension element of type <zeebe:TaskDefinition> not allowed',
78
+ path: getPath(taskDefinition, node),
79
+ error: {
80
+ type: ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED,
81
+ node,
82
+ parentNode: null,
83
+ extensionElement: taskDefinition
84
+ }
85
+ });
86
+
87
+ return;
88
+ }
89
+
90
+ errors = hasProperties(taskDefinition, {
91
+ type: {
92
+ required: true
93
+ }
94
+ }, node);
95
+
96
+ if (errors && errors.length) {
97
+ reportErrors(node, reporter, errors);
98
+ }
99
+ }
100
+
101
+ if (isAny(node, elementsCalledDecision) && isAny(node, elementsTaskDefinition)) {
102
+ errors = hasExtensionElementsOfTypes(node, [
103
+ 'zeebe:CalledDecision',
104
+ 'zeebe:TaskDefinition'
105
+ ], node, true);
106
+ } else if (isAny(node, elementsCalledDecision)) {
107
+ errors = hasExtensionElementOfType(node, 'zeebe:CalledDecision', node);
108
+ } else {
109
+ errors = hasExtensionElementOfType(node, 'zeebe:TaskDefinition', node);
110
+ }
111
+
112
+ if (errors && errors.length) {
113
+ reportErrors(node, reporter, errors);
114
+
115
+ return;
116
+ }
117
+ }
118
+
119
+ return {
120
+ check
121
+ };
122
+ };
@@ -0,0 +1,41 @@
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const {
4
+ findExtensionElement,
5
+ hasExtensionElementOfType,
6
+ hasProperties
7
+ } = require('./utils/element');
8
+
9
+ const { reportErrors } = require('./utils/reporter');
10
+
11
+ module.exports = function() {
12
+ function check(node, reporter) {
13
+ if (!is(node, 'bpmn:CallActivity')) {
14
+ return;
15
+ }
16
+
17
+ let errors = hasExtensionElementOfType(node, 'zeebe:CalledElement', node);
18
+
19
+ if (errors && errors.length) {
20
+ reportErrors(node, reporter, errors);
21
+
22
+ return;
23
+ }
24
+
25
+ const calledElement = findExtensionElement(node, 'zeebe:CalledElement');
26
+
27
+ errors = hasProperties(calledElement, {
28
+ processId: {
29
+ required: true
30
+ }
31
+ }, node);
32
+
33
+ if (errors && errors.length) {
34
+ reportErrors(node, reporter, errors);
35
+ }
36
+ }
37
+
38
+ return {
39
+ check
40
+ };
41
+ };
@@ -0,0 +1,186 @@
1
+ module.exports = {
2
+ camundaCloud10: {
3
+ elements: [
4
+ 'bpmn:Association',
5
+ 'bpmn:BoundaryEvent',
6
+ 'bpmn:CallActivity',
7
+ 'bpmn:Collaboration',
8
+ 'bpmn:Definitions',
9
+ 'bpmn:EndEvent',
10
+ 'bpmn:EventBasedGateway',
11
+ 'bpmn:ExclusiveGateway',
12
+ 'bpmn:Group',
13
+ 'bpmn:IntermediateCatchEvent',
14
+ 'bpmn:MessageFlow',
15
+ 'bpmn:ParallelGateway',
16
+ 'bpmn:Participant',
17
+ 'bpmn:Process',
18
+ 'bpmn:ReceiveTask',
19
+ 'bpmn:SequenceFlow',
20
+ 'bpmn:ServiceTask',
21
+ 'bpmn:StartEvent',
22
+ 'bpmn:SubProcess',
23
+ 'bpmn:TextAnnotation',
24
+ 'bpmn:UserTask'
25
+ ],
26
+ elementsNoEventDefinitionRequired: [
27
+ 'bpmn:EndEvent',
28
+ 'bpmn:StartEvent'
29
+ ],
30
+ eventDefinitions: {
31
+ 'bpmn:BoundaryEvent': [
32
+ 'bpmn:ErrorEventDefinition',
33
+ 'bpmn:MessageEventDefinition',
34
+ 'bpmn:TimerEventDefinition'
35
+ ],
36
+ 'bpmn:EndEvent': [
37
+ 'bpmn:ErrorEventDefinition'
38
+ ],
39
+ 'bpmn:IntermediateCatchEvent': [
40
+ 'bpmn:MessageEventDefinition',
41
+ 'bpmn:TimerEventDefinition'
42
+ ],
43
+ 'bpmn:StartEvent': [
44
+ 'bpmn:ErrorEventDefinition',
45
+ 'bpmn:MessageEventDefinition',
46
+ 'bpmn:TimerEventDefinition'
47
+ ]
48
+ }
49
+ },
50
+ camundaCloud11: {
51
+ elements: [
52
+
53
+ // 1.0
54
+ 'bpmn:Association',
55
+ 'bpmn:BoundaryEvent',
56
+ 'bpmn:CallActivity',
57
+ 'bpmn:Collaboration',
58
+ 'bpmn:Definitions',
59
+ 'bpmn:EndEvent',
60
+ 'bpmn:EventBasedGateway',
61
+ 'bpmn:ExclusiveGateway',
62
+ 'bpmn:Group',
63
+ 'bpmn:IntermediateCatchEvent',
64
+ 'bpmn:MessageFlow',
65
+ 'bpmn:ParallelGateway',
66
+ 'bpmn:Participant',
67
+ 'bpmn:Process',
68
+ 'bpmn:ReceiveTask',
69
+ 'bpmn:SequenceFlow',
70
+ 'bpmn:ServiceTask',
71
+ 'bpmn:StartEvent',
72
+ 'bpmn:SubProcess',
73
+ 'bpmn:TextAnnotation',
74
+ 'bpmn:UserTask',
75
+
76
+ // 1.1
77
+ 'bpmn:BusinessRuleTask',
78
+ 'bpmn:IntermediateThrowEvent',
79
+ 'bpmn:ManualTask',
80
+ 'bpmn:ScriptTask',
81
+ 'bpmn:SendTask'
82
+ ],
83
+ elementsNoEventDefinitionRequired: [
84
+
85
+ // 1.0
86
+ 'bpmn:EndEvent',
87
+ 'bpmn:StartEvent',
88
+
89
+ // 1.1
90
+ 'bpmn:IntermediateThrowEvent'
91
+ ],
92
+ eventDefinitions: {
93
+ 'bpmn:BoundaryEvent': [
94
+ 'bpmn:ErrorEventDefinition',
95
+ 'bpmn:MessageEventDefinition',
96
+ 'bpmn:TimerEventDefinition'
97
+ ],
98
+ 'bpmn:EndEvent': [
99
+ 'bpmn:ErrorEventDefinition'
100
+ ],
101
+ 'bpmn:IntermediateCatchEvent': [
102
+ 'bpmn:MessageEventDefinition',
103
+ 'bpmn:TimerEventDefinition'
104
+ ],
105
+ 'bpmn:StartEvent': [
106
+ 'bpmn:ErrorEventDefinition',
107
+ 'bpmn:MessageEventDefinition',
108
+ 'bpmn:TimerEventDefinition'
109
+ ]
110
+ }
111
+ },
112
+ camundaCloud12: {
113
+ elements: [
114
+
115
+ // 1.0
116
+ 'bpmn:Association',
117
+ 'bpmn:BoundaryEvent',
118
+ 'bpmn:CallActivity',
119
+ 'bpmn:Collaboration',
120
+ 'bpmn:Definitions',
121
+ 'bpmn:EndEvent',
122
+ 'bpmn:EventBasedGateway',
123
+ 'bpmn:ExclusiveGateway',
124
+ 'bpmn:Group',
125
+ 'bpmn:IntermediateCatchEvent',
126
+ 'bpmn:MessageFlow',
127
+ 'bpmn:ParallelGateway',
128
+ 'bpmn:Participant',
129
+ 'bpmn:Process',
130
+ 'bpmn:ReceiveTask',
131
+ 'bpmn:SequenceFlow',
132
+ 'bpmn:ServiceTask',
133
+ 'bpmn:StartEvent',
134
+ 'bpmn:SubProcess',
135
+ 'bpmn:TextAnnotation',
136
+ 'bpmn:UserTask',
137
+
138
+ // 1.1
139
+ 'bpmn:BusinessRuleTask',
140
+ 'bpmn:IntermediateThrowEvent',
141
+ 'bpmn:ManualTask',
142
+ 'bpmn:ScriptTask',
143
+ 'bpmn:SendTask'
144
+ ],
145
+ elementsNoEventDefinitionRequired: [
146
+
147
+ // 1.0
148
+ 'bpmn:EndEvent',
149
+ 'bpmn:StartEvent',
150
+
151
+ // 1.1
152
+ 'bpmn:IntermediateThrowEvent'
153
+ ],
154
+ eventDefinitions: {
155
+
156
+ // 1.1
157
+ 'bpmn:BoundaryEvent': [
158
+ 'bpmn:ErrorEventDefinition',
159
+ 'bpmn:MessageEventDefinition',
160
+ 'bpmn:TimerEventDefinition'
161
+ ],
162
+ 'bpmn:EndEvent': [
163
+
164
+ // 1.0
165
+ 'bpmn:ErrorEventDefinition',
166
+
167
+ // 1.1
168
+ 'bpmn:MessageEventDefinition'
169
+ ],
170
+ 'bpmn:IntermediateCatchEvent': [
171
+ 'bpmn:MessageEventDefinition',
172
+ 'bpmn:TimerEventDefinition'
173
+ ],
174
+ 'bpmn:StartEvent': [
175
+ 'bpmn:ErrorEventDefinition',
176
+ 'bpmn:MessageEventDefinition',
177
+ 'bpmn:TimerEventDefinition'
178
+ ],
179
+
180
+ // 1.2
181
+ 'bpmn:IntermediateThrowEvent': [
182
+ 'bpmn:MessageEventDefinition'
183
+ ]
184
+ }
185
+ }
186
+ };
@@ -0,0 +1,86 @@
1
+ const { isAny } = require('bpmnlint-utils');
2
+
3
+ const {
4
+ isAnyExactly,
5
+ getEventDefinition
6
+ } = require('../utils/element');
7
+
8
+ const { ERROR_TYPES } = require('../utils/error-types');
9
+
10
+ const { reportErrors } = require('../utils/reporter');
11
+
12
+ module.exports = function(config) {
13
+ const {
14
+ elements,
15
+ elementsNoEventDefinitionRequired,
16
+ eventDefinitions
17
+ } = config;
18
+
19
+ function check(node, reporter) {
20
+ if (!isAny(node, [ 'bpmn:FlowElement', 'bpmn:FlowElementsContainer' ])) {
21
+ return;
22
+ }
23
+
24
+ if (!isAnyExactly(node, elements)) {
25
+ const error = {
26
+ message: `Element of type <${ node.$type }> not allowed`,
27
+ path: null,
28
+ error: {
29
+ type: ERROR_TYPES.ELEMENT_TYPE_NOT_ALLOWED,
30
+ node,
31
+ parentNode: null
32
+ }
33
+ };
34
+
35
+ reportErrors(node, reporter, error);
36
+
37
+ return;
38
+ }
39
+
40
+ const eventDefinition = getEventDefinition(node);
41
+
42
+ if (isAny(node, [ 'bpmn:CatchEvent', 'ThrowEvent' ]) && !eventDefinition && !elementsNoEventDefinitionRequired.includes(node.$type)) {
43
+ const error = {
44
+ message: `Element of type <${ node.$type }> must have property <eventDefinitions>`,
45
+ path: [ 'eventDefinitions' ],
46
+ error: {
47
+ type: ERROR_TYPES.PROPERTY_REQUIRED,
48
+ node,
49
+ parentNode: null,
50
+ requiredProperty: 'eventDefinitions'
51
+ }
52
+ };
53
+
54
+ reportErrors(node, reporter, error);
55
+
56
+ return;
57
+ }
58
+
59
+ if (!eventDefinition) {
60
+ return;
61
+ }
62
+
63
+ if (!eventDefinitions[ node.$type ] || !isAny(eventDefinition, eventDefinitions[ node.$type ])) {
64
+ const error = {
65
+ message: `Property of type <${ eventDefinition.$type }> not allowed`,
66
+ path: [
67
+ 'eventDefinitions',
68
+ 0
69
+ ],
70
+ error: {
71
+ type: ERROR_TYPES.PROPERTY_TYPE_NOT_ALLOWED,
72
+ node: node,
73
+ parentNode: null,
74
+ property: 'eventDefinitions',
75
+ requiredPropertyType: eventDefinitions[ node.$type ]
76
+ }
77
+ };
78
+
79
+ reportErrors(node, reporter, error);
80
+ }
81
+ }
82
+
83
+ return {
84
+ check
85
+ };
86
+ };