Subject of the issue
Updates to existing Data Type templates can result in data loss. E.g. Adding a DO to a LNodeType can result in some of the structures the LNodeType references, get removed.
Your environment
Steps to reproduce
Attached file was used for reproducing this issue:
SclTemplateUpdate-dropped-elements-bug.zip
- Open the attached SCD file in OpenSCD
- Verify the SCD file is valid before changing anything
- If not already present, add the "Template Update" plugin
- In the Template plugin, select PDIS$oscd$_...

- Select Mod
- Add some Enums for the ctlModel

7. Add some Enums for the stVal

8. Click on the "Update Logical Node Type" fab button
9. Re-run the validator
Expected behaviour
The LNodeType is updated correctly, such that the element as exactly the same (unchanged children) + the addition of the Mod DOType.
Actual behaviour
The SCL file is no longer Schema Valid:

Additionally - I believe the existing LNodeType should remain "as-is" in case its already being referenced - as we cannot assume all places where it is currently being referenced, actually want (or can support) and updated version of this LNodeType. But perhaps this should be raised as another bug - unless this is now "by design" how it should be.
<LNodeType lnClass="PDIS" desc="Distance" id="PDIS$oscd$_6d6fe5ccce4bb658">
<DO name="Beh" type="Beh$oscd$_c6ed035c8137b35a"/>
<DO name="Op" type="Op$oscd$_8598a343000a4c8c" transient="true"/>
<DO name="Str" type="Str$oscd$_ba49448ecb46113a"/>
<DO name="DirMod" type="DirMod$oscd$_586debcdfc6172b8"/><!-- missing -->
<DO name="GndDlTmms" type="GndDlTmms$oscd$_f1c0d370e7430e0c"/><!-- missing -->
<DO name="PhDlTmms" type="PhDlTmms$oscd$_f1c0d370e7430e0c"/><!-- missing -->
<DO name="Mod" type="Mod$oscd$_a9263163d22902bb"/>
</LNodeType>
The following DOTypes were removed:
- DirMod$oscd$_586debcdfc6172b8
- GndDlTmms$oscd$_f1c0d370e7430e0c
- PhDlTmms$oscd$_f1c0d370e7430e0c
The reset remained.
Subject of the issue
Updates to existing Data Type templates can result in data loss. E.g. Adding a DO to a LNodeType can result in some of the structures the LNodeType references, get removed.
Your environment
Steps to reproduce
Attached file was used for reproducing this issue:
SclTemplateUpdate-dropped-elements-bug.zip
Expected behaviour
The LNodeType is updated correctly, such that the element as exactly the same (unchanged children) + the addition of the Mod DOType.
Actual behaviour

The SCL file is no longer Schema Valid:
Additionally - I believe the existing LNodeType should remain "as-is" in case its already being referenced - as we cannot assume all places where it is currently being referenced, actually want (or can support) and updated version of this LNodeType. But perhaps this should be raised as another bug - unless this is now "by design" how it should be.
The following DOTypes were removed:
The reset remained.