fix(modeler): activiti.json 修 Modeler.saveXML 大写元素名(断部署)+真Modeler序列化回归测试
CRITICAL:bpmn-js Modeler.saveXML 把被 activiti.json `extends` 的 bpmn 类型序列化成
PascalCase 元素名(<Process>/<UserTask>/<StartEvent>…),未扩展的 <sequenceFlow>/<endEvent>
仍小写。Flowable 大小写敏感 → <Process> 不被识别为流程,ProcessValidator 报
flowable-process-definition-not-executable,部署完全失败。
根因:moddle 把「被扩展类型」的合并描述符 $pkg 设为**最后一个 trait 的包**(moddle
index.esm.js:577)。activiti 包缺 `xml.tagAlias:"lowerCase"`,故 moddle-xml 写元素名时不做
首字母小写 → PascalCase。且 tagAlias 是**双向**的(也驱动 fromXML 解析),要求自定义元素类型名
用 activiti/camunda 惯例的 PascalCase,否则解析 <activiti:taskListener> 找不到类型而丢弃。
修法(对齐 activiti/camunda-bpmn-moddle 标准):
- activiti.json + flowable.json 加 `"xml": { "tagAlias": "lowerCase" }`;
- 自定义元素类型名改 PascalCase:taskListener→TaskListener / executionListener→ExecutionListener
/ field→Field / formProperty→FormProperty / value→Value / in→In / out→Out(属性 type 引用同步)。
XML 元素名仍小写(tagAlias),故 fixture 与「toContain('activiti:taskListener')」类 XML 断言不变。
- Eip4Panel.tsx:moddle.create/$type 用 'activiti:TaskListener';测试 fake 类型名同步。
为何旧测试没抓到:T1.1/T1.2 只断言 activiti 扩展属性/元素多重集,从不断言基础 BPMN 元素名大小写;
fromXML→toXML 与 create 都走同一 moddle-xml Writer 且都产 PascalCase(本 commit 实证)。
新增 serialization.test.ts(4 例,RED→GREEN):以 BpmnModdle(= Modeler.saveXML 的 moddle 层,
jsdom 跑不动 diagram-js SVG)驱动 fromXML→toXML 与 create→toXML,断言基础元素名全小写、无 PascalCase、
isExecutable 保留、扩展元素/属性不丢;flowable 隔离同验。
serialization 4 + fidelity 12 + Eip4Panel 37;全量 231 单测绿,tsc -b rc=0 + build 干净。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
"name": "Activiti",
|
||||
"uri": "http://activiti.org/bpmn",
|
||||
"prefix": "activiti",
|
||||
"xml": { "tagAlias": "lowerCase" },
|
||||
"associations": [],
|
||||
"types": [
|
||||
{
|
||||
@@ -90,7 +91,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "taskListener",
|
||||
"name": "TaskListener",
|
||||
"superClass": ["Element"],
|
||||
"meta": { "allowedIn": ["bpmn:UserTask"] },
|
||||
"properties": [
|
||||
@@ -98,11 +99,11 @@
|
||||
{ "name": "class", "isAttr": true, "type": "String" },
|
||||
{ "name": "expression", "isAttr": true, "type": "String" },
|
||||
{ "name": "delegateExpression", "isAttr": true, "type": "String" },
|
||||
{ "name": "fields", "type": "field", "isMany": true }
|
||||
{ "name": "fields", "type": "Field", "isMany": true }
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "executionListener",
|
||||
"name": "ExecutionListener",
|
||||
"superClass": ["Element"],
|
||||
"meta": { "allowedIn": ["*"] },
|
||||
"properties": [
|
||||
@@ -110,11 +111,11 @@
|
||||
{ "name": "class", "isAttr": true, "type": "String" },
|
||||
{ "name": "expression", "isAttr": true, "type": "String" },
|
||||
{ "name": "delegateExpression", "isAttr": true, "type": "String" },
|
||||
{ "name": "fields", "type": "field", "isMany": true }
|
||||
{ "name": "fields", "type": "Field", "isMany": true }
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "field",
|
||||
"name": "Field",
|
||||
"superClass": ["Element"],
|
||||
"meta": { "allowedIn": ["*"] },
|
||||
"properties": [
|
||||
@@ -125,7 +126,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "formProperty",
|
||||
"name": "FormProperty",
|
||||
"superClass": ["Element"],
|
||||
"meta": { "allowedIn": ["*"] },
|
||||
"properties": [
|
||||
@@ -140,11 +141,11 @@
|
||||
{ "name": "datePattern", "isAttr": true, "type": "String" },
|
||||
{ "name": "default", "isAttr": true, "type": "String" },
|
||||
{ "name": "value", "isAttr": true, "type": "String" },
|
||||
{ "name": "values", "type": "value", "isMany": true }
|
||||
{ "name": "values", "type": "Value", "isMany": true }
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"name": "Value",
|
||||
"superClass": ["Element"],
|
||||
"properties": [
|
||||
{ "name": "id", "isAttr": true, "type": "String" },
|
||||
@@ -152,7 +153,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "in",
|
||||
"name": "In",
|
||||
"superClass": ["Element"],
|
||||
"meta": { "allowedIn": ["*"] },
|
||||
"properties": [
|
||||
@@ -163,7 +164,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "out",
|
||||
"name": "Out",
|
||||
"superClass": ["Element"],
|
||||
"meta": { "allowedIn": ["*"] },
|
||||
"properties": [
|
||||
|
||||
Reference in New Issue
Block a user