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

Prepare v3.10.0 Release #91

Merged
merged 3 commits into from
Nov 7, 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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ All notable changes to [@camunda/linting](https://github.com/camunda/linting) ar

___Note:__ Yet to be released changes appear here._

## 3.10.0

* `FEAT`: add 8.4 and 7.21 config ([#143](https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/143))
* `FEAT`: validate `formId` with Camunda 8.4 and newer ([#144](https://github.com/camunda/bpmnlint-plugin-camunda-compat/issues/144))
* `DEPS`: update to `[email protected]`

## 3.9.0

* `FEAT`: rename `Camunda Platform` to `Camunda` ([#89](https://github.com/camunda/linting/pull/89))
Expand Down
23 changes: 20 additions & 3 deletions lib/utils/error-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { is, isAny } from 'bpmnlint-utils';

import {
every,
isArray
isArray,
isString
} from 'min-dash';

import { getTypeString } from './types';
Expand Down Expand Up @@ -394,6 +395,10 @@ function getPropertyNotAllowedErrorMessage(report, executionPlatform, executionP
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <${ TIMER_PROPERTY_LABELS[ property ] }>`, executionPlatform, executionPlatformVersion, allowedVersion);
}

if (is(node, 'zeebe:FormDefinition') && property === 'formId') {
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: Camunda form (linked)>`, executionPlatform, executionPlatformVersion, allowedVersion);
}

return message;
}

Expand Down Expand Up @@ -483,12 +488,20 @@ function getPropertyRequiredErrorMessage(report, executionPlatform, executionPla
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Signal Reference>`;
}

if (is(node, 'zeebe:FormDefinition') && requiredProperty === 'formKey') {
if (is(node, 'zeebe:FormDefinition')
&& (
requiredProperty === 'formKey'
|| (isArray(requiredProperty) && requiredProperty.includes('formKey') && isEmptyString(node.get('formKey')))
)) {
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: Custom form key> must have a defined <Form key>`;
}

if (is(node, 'zeebe:FormDefinition') && isArray(requiredProperty) && requiredProperty.includes('formId') && isEmptyString(node.get('formId'))) {
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: Camunda form (linked)> must have a defined <Form ID>`;
}

if (is(node, 'zeebe:UserTaskForm') && requiredProperty === 'body') {
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: Camunda forms> must have a defined <Form JSON configuration>`;
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: Camunda form (embedded)> must have a defined <Form JSON configuration>`;
}

if (is(node, 'bpmn:SequenceFlow') && requiredProperty === 'conditionExpression') {
Expand Down Expand Up @@ -672,4 +685,8 @@ function getLoopNotAllowedErrorMessage(report) {
const { elements } = data;

return `A <Process> is not allowed to contain a straight-through processing loop: ${ elements.map(element => `<${ element }>`).join(', ') }`;
}

function isEmptyString(value) {
return isString(value) && value.trim() === '';
}
34 changes: 33 additions & 1 deletion lib/utils/properties-panel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { isArray } from 'min-dash';
import {
isArray,
isString
} from 'min-dash';

import { is } from 'bpmnlint-utils';

Expand Down Expand Up @@ -159,6 +162,23 @@ export function getEntryIds(report) {
return [ 'customFormKey' ];
}

if (isType(data, 'zeebe:FormDefinition')) {
const {
node,
requiredProperty
} = data;

if (isArray(requiredProperty) && requiredProperty.includes('formKey') && isEmptyString(node.get('formKey'))) {
return [ 'customFormKey' ];
} else if (isArray(requiredProperty) && requiredProperty.includes('formId') && isEmptyString(node.get('formId'))) {
return [ 'formId' ];
}
}

if (isPropertyError(data, 'formId', 'zeebe:FormDefinition')) {
return [ 'formId' ];
}

if (isPropertyError(data, 'body', 'zeebe:UserTaskForm')) {
return [ 'formConfiguration' ];
}
Expand Down Expand Up @@ -396,6 +416,14 @@ export function getErrorMessage(id, report) {
return 'Form key must be defined.';
}

if (id === 'formId') {
if (data.type === ERROR_TYPES.PROPERTY_REQUIRED) {
return 'Form ID must be defined.';
} else if (data.type === ERROR_TYPES.PROPERTY_NOT_ALLOWED) {
return 'Form ID not supported.';
}
}

if (id === 'formConfiguration') {
return 'Form JSON configuration must be defined.';
}
Expand Down Expand Up @@ -547,4 +575,8 @@ function isElementPropertyValueDuplicated(data, propertyName, type) {

function getBusinessObject(element) {
return element.businessObject || element;
}

function isEmptyString(value) {
return isString(value) && value.trim() === '';
}
Loading
Loading