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: remove extra parsing of lane elements which are not in the BPMN spec #2805

Merged
merged 5 commits into from
Aug 24, 2023

Conversation

csouchet
Copy link
Member

@csouchet csouchet commented Aug 22, 2023

  1. Fix in TProcess parsing: Removed unnecessary parsing of lane elements of the TProcess type that are not specified in the BPMN specification. This ensures correct parsing behavior.
  2. Property removal: The [key: string]: any; property has been removed from both the TProcess and TDefinitions classes. This prevents inadvertent access to non-existent properties within these objects.
  3. JSONBuilder Function Renaming and Enhancement: Renamed the updateBpmnElement function within the JSONBuilder class for better clarity. The function code has also been streamlined to improve readability and comprehension.

Closes #2188

@csouchet csouchet added the bug Something isn't working label Aug 22, 2023
@github-actions
Copy link

github-actions bot commented Aug 22, 2023

♻️ PR Preview 1ed1609 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@github-actions
Copy link

github-actions bot commented Aug 22, 2023

♻️ PR Preview 1ed1609 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@csouchet csouchet marked this pull request as ready for review August 22, 2023 13:01
- update unit tests for lane/laneSet
- remove the configuration of TProcess type to set any string as property like : process[ShapeBpmnElementKind.LANE]
@csouchet csouchet force-pushed the 2188-Remove_extra_parsing_of_lane_elements branch from 2912245 to ee7e9ca Compare August 22, 2023 13:33
Copy link
Member

@tbouffard tbouffard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️ the fix looks OK
❌ too much unrelated changes in types usage and naming to be discussed

// sometimes eventDefinition is simple and therefore it is parsed as empty string "", in that case eventDefinition will be converted to an empty object
const eventDefinitions: string | TEventDefinition | (string | TEventDefinition)[] = definitions[eventDefinitionKind + 'EventDefinition'];
// sometimes eventDefinition is simple, and therefore it is parsed as empty string "", in that case eventDefinition will be converted to an empty object
const eventDefinitions = definitions[(eventDefinitionKind + 'EventDefinition') as keyof TDefinitions] as EventDefinitions;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: It is fine to introduce the new type as the code is now easier to read IMHO.
However, I don't understand why switching the syntax to "as"? I suggest to keep the existing it and to set an eslint rules to enforce this as part of #2742.

These are clearly extra changes. During my review, I had to wonder if this was part of the correction. So I guess if I or anyone else reads this in the future, the same question will arise.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do it, because is not working with the last syntax due to the remove of [key:string]:any 🙂

@@ -70,9 +70,9 @@ const computeSubProcessKind = (processedSemanticType: BpmnSemanticType, bpmnElem
}
};

const orderedFlowNodeBpmnTypes: BpmnSemanticType[] = ['adHocSubProcess', 'transaction'] // specific management for adhoc and transaction sub-processes which are handled with a dedicated ShapeBpmnSubProcessKind
const orderedFlowNodeBpmnTypes: BpmnSemanticType[] = (['adHocSubProcess', 'transaction'] as BpmnSemanticType[]) // specific management for adhoc and transaction sub-processes which are handled with a dedicated ShapeBpmnSubProcessKind
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Same question as in EventDefinitionConverter.ts about switching the syntax to "as".
We already have this discussion when I create the PR about this code, and we concluded that this was extra typing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same answer, TypeScript send an error due to the removing of [key:string]:any 🙂

test/unit/helpers/JsonBuilder.ts Outdated Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Aug 24, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

@tbouffard tbouffard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the clarifications and integrating my suggestions.

@tbouffard tbouffard merged commit 6f63d69 into master Aug 24, 2023
23 checks passed
@tbouffard tbouffard deleted the 2188-Remove_extra_parsing_of_lane_elements branch August 24, 2023 12:03
@tbouffard tbouffard changed the title fix: remove extra parsing of lane elements which are not in the BPMN spec fix: remove extra parsing of lane elements Aug 24, 2023
@tbouffard tbouffard changed the title fix: remove extra parsing of lane elements fix: remove extra parsing of lane elements which are not in the BPMN spec Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Extra parsing of lane elements which are not in the BPMN spec
2 participants