Skip to content

fix(drd): always export a name for DRG elements - #1061

Open
EnesKartal wants to merge 1 commit into
bpmn-io:developfrom
EnesKartal:fix/decision-name-required
Open

EnesKartal wants to merge 1 commit into
bpmn-io:developfrom
EnesKartal:fix/decision-name-required

Conversation

@EnesKartal

Copy link
Copy Markdown

Proposed Changes

Closes #1057

The DMN 1.3 schema requires name on every DRG element. A decision, business knowledge model, input data or knowledge source created from the palette or context pad had no name until the user typed one, and erasing a name with direct editing removed the attribute again. The exported XML then failed XSD validation (Attribute 'name' must appear on element 'decision').

This change:

  • creates DRG elements with name="" in ElementFactory when the new business object has no name. The default variable that CreateShapeBehavior adds to decisions and input data takes this name, so it gets name="" too.
  • keeps name="" when a name is erased in setLabel, instead of removing the attribute. As suggested in the issue, an empty name is the default even after the name is erased.

Text annotations are not changed.

Test plan

  • Added ElementFactorySpec cases: the four element types are created with name === '', and a given name is kept.
  • Updated LabelEditingProviderSpec > should remove label: it now expects '' where it expected the attribute to be removed.

Before the fix (targeted specs):

✗ features - label-editing > update label > should remove label
    AssertionError: expected null to equal ''
✗ features/modeling - create elements > basics > should create dmn:Decision with empty name
    AssertionError: expected undefined to equal ''
(... same for BusinessKnowledgeModel, InputData, KnowledgeSource)
# tests 46  ✓ pass 41  ✗ fail 5

After the fix, the full dmn-js-drd suite passes (# tests 471, ✗ fail 0), and eslint passes on the changed files.

Steps to try out: in the DRD modeler, add a decision from the palette, close direct editing without typing, then export. The decision and its variable now have name="".

Checklist

Ensure you provide everything we need to review your contribution:

  • Contribution meets our definition of done
  • Pull request establishes context
    • Link to related issue(s), i.e. Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}
    • Brief textual description of the changes
    • Screenshots or short videos showing UI/UX changes
    • Steps to try out, i.e. using the @bpmn-io/sr tool

The DMN schema requires a name on decisions, business knowledge models,
input data, knowledge sources and decision services. Elements created
from the palette or context pad had no name until one was typed in,
and erasing a name removed the attribute again, so the exported XML
failed schema validation.

Create these elements with an empty name, and keep an empty name when
the label is erased.

Closes bpmn-io#1057
@EnesKartal
EnesKartal requested review from a team and a balanced review from Copilot November 14, 2026 06:58
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@fake-join fake-join Bot added needs:cla Requires CLA to be signed needs:ci-approval Requires approval of workflow runs labels Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:ci-approval Requires approval of workflow runs needs:cla Requires CLA to be signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing name attribute on unnamed decision leads to XSD validation error

3 participants