Skip to content

Template Update: overwrites / removes existing data #5

@stee-re

Description

@stee-re

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

  1. Open the attached SCD file in OpenSCD
  2. Verify the SCD file is valid before changing anything
  3. If not already present, add the "Template Update" plugin
  4. In the Template plugin, select PDIS$oscd$_... Image
  5. Select Mod
  6. Add some Enums for the ctlModel
Image 7. Add some Enums for the stVal Image 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:
Image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions