legend-studio icon indicating copy to clipboard operation
legend-studio copied to clipboard

Bug: When property from class is deleted, mapping that has the property does not delete

Open xannem opened this issue 2 years ago • 1 comments

Similar issues

  • [X] I have searched and found no existing similar issues

How are you using Studio?

Legend Studio

Current and expected behavior

When the user deletes a property from the class, mappings related to the property will be deleted in the form editor view but only when user tries to hit compile it throws an error and forces user to text-mode to manually delete and address the properties themselves.

Expected behavior might be that the mapping with the deleted property itself has that portion deleted as well, or for there to be a warning immediately that is more specific rather than waiting for user.

Steps to reproduce

Kapture 2022-09-13 at 00 14 38

  1. Delete the class property from text editor
  2. Hit compile

Model data

Class testing::Person
{
  firstName: String[1];
  middleName: String[1];
  lastName: String[1];
}

Class testing::NewPerson
{
  name: String[1];
}


###Mapping
Mapping testing::NewPersonMapping
(
  *testing::NewPerson: Pure
  {
    ~src testing::Person
    name: $src.firstName + ' ' + $src.lastName
  }
)

Environment

No response

Possible solution and workaround

No response

Contribution

  • [ ] I would like to work on the fix for this issue

xannem avatar Sep 13 '22 04:09 xannem

We don't have a proper reverse-reference mechanism, i.e. there's no way to tell from a property who is referring to it, as such, it's not possible for us to go through and fix the graph automatically when we delete something.

When deleting elements, we call engine to compile, so we can properly fall back into text-mode if there's a compilation error but we only do so because that action often has a huge impact on the correctness of the graph. However, for little modifications of the graph in form-mode, such as, renaming properties, and deleting properties, we don't necessarily want to call engine as it could be too overkill (though we could re-consider this position in the future).

This is definitely a bug, but we will keep it in the backlog till we have time to properly address it

akphi avatar Sep 19 '22 20:09 akphi