Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disallow error references without error code #89

Merged
merged 1 commit into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions rules/error-reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ module.exports = skipInNonExecutableProcess(function({ version }) {

errors = hasProperties(errorRef, {
errorCode: {
required: true,
allowedVersion: '8.2'
required: true
}
}, node);

Expand Down
23 changes: 4 additions & 19 deletions test/camunda-cloud/error-reference.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,6 @@ const valid = [
</bpmn:boundaryEvent>
`))
},
{
name: 'error boundary event (no error code) (Camunda 8.2)',
config: { version: '8.2' },
moddleElement: createModdle(createDefinitions(`
<bpmn:process id="Process_1">
<bpmn:task id="Task_1" />
<bpmn:boundaryEvent id="BoundaryEvent_1" attachedToRef="Task_1">
<bpmn:errorEventDefinition id="ErrorEventDefinition_1" errorRef="Error_1" />
</bpmn:boundaryEvent>
</bpmn:process>
<bpmn:error id="Error_1" />
`))
},
{
name: 'error end event (no error reference) (non-executable process)',
config: { version: '8.2' },
Expand Down Expand Up @@ -117,7 +104,7 @@ const invalid = [
`)),
report: {
id: 'EndEvent_1',
message: 'Element of type <bpmn:Error> without property <errorCode> only allowed by Camunda Platform 8.2 or newer',
message: 'Element of type <bpmn:Error> must have property <errorCode>',
path: [
'rootElements',
1,
Expand All @@ -127,8 +114,7 @@ const invalid = [
type: ERROR_TYPES.PROPERTY_REQUIRED,
node: 'Error_1',
parentNode: 'EndEvent_1',
requiredProperty: 'errorCode',
allowedVersion: '8.2'
requiredProperty: 'errorCode'
}
}
},
Expand Down Expand Up @@ -172,7 +158,7 @@ const invalid = [
`)),
report: {
id: 'BoundaryEvent_1',
message: 'Element of type <bpmn:Error> without property <errorCode> only allowed by Camunda Platform 8.2 or newer',
message: 'Element of type <bpmn:Error> must have property <errorCode>',
path: [
'rootElements',
1,
Expand All @@ -182,8 +168,7 @@ const invalid = [
type: ERROR_TYPES.PROPERTY_REQUIRED,
node: 'Error_1',
parentNode: 'BoundaryEvent_1',
requiredProperty: 'errorCode',
allowedVersion: '8.2'
requiredProperty: 'errorCode'
}
}
},
Expand Down