Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the default-variable changes.
No open issues 🎉
What changed in this PR
Addresses #1051 by extending default variable creation in dmn-js-drd to business knowledge models and adding the missing type reference for decision services, while preserving existing variables.
Changes:
- Create named variables with
typeRef="Any"for new business knowledge models. - Set
typeRef="Any"on newly created decision service variables. - Add regression assertions and document the feature in the changelog.
| File | Description |
|---|---|
packages/dmn-js/CHANGELOG.md |
Documents the default-variable changes and links #1051. |
packages/dmn-js-drd/test/spec/features/modeling/ElementFactorySpec.js |
Checks the decision service variable’s default type. |
packages/dmn-js-drd/test/spec/features/modeling/behavior/CreateShapeBehaviorSpec.js |
Tests business knowledge model variable creation, name, type, and parent. |
packages/dmn-js-drd/src/features/modeling/ElementFactory.js |
Adds typeRef="Any" to new decision service variables. |
packages/dmn-js-drd/src/features/modeling/behavior/CreateShapeBehavior.js |
Extends default variable creation to business knowledge models and updates its documentation. |
Review effort: Balanced
|
This pull request went stale - we have not heard from you in more than 7 days. To move it forward, please:
This unblocks a review - it is not a guarantee of being merged. Without activity this pull request will be closed in 14 days. Any activity - a push, a comment, a description update, a re-requested review - keeps it open. |
barmac
left a comment
There was a problem hiding this comment.
Please have a look into the comments. We need to fix the broken implementation, and not build on top of it.
| @@ -81,7 +81,8 @@ ElementFactory.prototype.createDrdElement = function(elementType, attrs) { | |||
| // Create variable for Decision Service | |||
There was a problem hiding this comment.
Adding variable should not be done via ElementFactory, I missed that in the review. The right place for such defaults is via behaviors.
| var bkm = elementFactory.createShape({ type: 'dmn:BusinessKnowledgeModel' }); | ||
| modeling.createShape(bkm, { x: 100, y: 100 }, rootElement); |
There was a problem hiding this comment.
This will fail when we adopt correct architecture (adding variable via behavior).
|
Thanks for the review — agreed that default variables belong in modeling behaviors, not This update removes decision-service variable creation from Tests for BKM and decision service variables are in |
…a behavior Assign default InformationItem variables (typeRef="Any") for business knowledge models and decision services in CreateShapeBehavior on shape.create. Remove variable creation from ElementFactory so defaults follow the same pattern as decisions and input data. Closes bpmn-io#1051 Co-authored-by: Joel Shearon <hippi345@users.noreply.github.com> Co-authored-by: Joel Shearon <hippi345@users.noreply.github.com>
Co-authored-by: Joel Shearon <hippi345@users.noreply.github.com>
7f01a52 to
ac4d5c9
Compare
|
@barmac Rebuilt the branch on current |
Proposed Changes
New business knowledge models now get a
<variable>(named like the BKM,typeRef="Any"), the same way decisions and input data already do. Per review, default variable creation now lives only inCreateShapeBehavior(preExecuteonshape.create) for decisions, input data, BKMs and decision services;ElementFactoryno longer creates variables (it keeps the divider DI and the defaultNew Decision Servicename). Decision service variables also gettypeRef="Any". Existing variables are never touched, and the name sync inNameChangeBehavioralready covers BKMs.Tests: BKM and decision service cases live in
CreateShapeBehaviorSpec(created viamodeling.createShape); the decision service variable assertions moved out ofElementFactorySpec.dmn-js-drdkarma suite passes locally (466 passed, ChromeHeadless);npm run cipasses. Merged upstreamdevelopto resolve theCHANGELOG.mdconflict; the entry stays under Unreleased.No UI change, so no screenshots.
To try it out:
npx @bpmn-io/sr bpmn-io/dmn-js#bkm-ds-default-variable(or check out the branch and run the DRD starter), create a BKM or decision service, and inspect the exported XML for a<variable name="..." typeRef="Any" />.Closes #1051
Checklist
Ensure you provide everything we need to review your contribution:
Closes {LINK_TO_ISSUE}orRelated to {LINK_TO_ISSUE}@bpmn-io/srtool