Skip to content

Commit

Permalink
feat: allow collapsed subprocess in 8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
barmac committed Dec 14, 2023
1 parent 65f0282 commit cb702b0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
8 changes: 4 additions & 4 deletions lib/utils/error-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export function getErrorMessage(report, executionPlatform, executionPlatformVers
}

if (type === ERROR_TYPES.ELEMENT_COLLAPSED_NOT_ALLOWED) {
return getElementCollapsedNotAllowedErrorMessage(report);
return getElementCollapsedNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion);
}

if (type === ERROR_TYPES.ELEMENT_PROPERTY_VALUE_DUPLICATED) {
Expand Down Expand Up @@ -176,18 +176,18 @@ function getChildElementTypeNotAllowedErrorMessage(report, executionPlatform, ex
);
}

function getElementCollapsedNotAllowedErrorMessage(report) {
function getElementCollapsedNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion) {
const {
data,
message
} = report;

const { node } = data;
const { allowedVersion, node } = data;

const typeString = getTypeString(node);

if (is(node, 'bpmn:SubProcess')) {
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must be expanded`;
return getSupportedMessage(`A collapsed <${typeString}>`, executionPlatform, executionPlatformVersion, allowedVersion);
}

return message;
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@bpmn-io/diagram-js-ui": "^0.2.2",
"bpmn-moddle": "^8.0.0",
"bpmnlint": "^9.2.0",
"bpmnlint-plugin-camunda-compat": "^2.12.0",
"bpmnlint-plugin-camunda-compat": "^2.13.0",
"bpmnlint-utils": "^1.0.2",
"camunda-bpmn-moddle": "^7.0.1",
"clsx": "^2.0.0",
Expand Down
9 changes: 5 additions & 4 deletions test/spec/utils/error-messages.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,10 @@ describe('utils/error-messages', function() {
const report = await getLintError(di, rule);

// when
const errorMessage = getErrorMessage(report);
const errorMessage = getErrorMessage(report, 'Camunda Cloud', '8.3');

// then
expect(errorMessage).to.equal('A <Sub Process> must be expanded');
expect(errorMessage).to.equal('A collapsed <Sub Process> is only supported by Camunda 8.4 or newer');
});


Expand All @@ -247,10 +247,11 @@ describe('utils/error-messages', function() {
const report = await getLintError(di, rule);

// when
const errorMessage = getErrorMessage(report);
const errorMessage = getErrorMessage(report, 'Camunda Cloud', '8.3');

// then
expect(errorMessage).to.equal('An <Ad Hoc Sub Process> must be expanded');
console.log(errorMessage);
expect(errorMessage).to.equal('A collapsed <Ad Hoc Sub Process> is only supported by Camunda 8.4 or newer');
});

});
Expand Down

0 comments on commit cb702b0

Please sign in to comment.