Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintain $parent safely within the core #41

Open
1 task
nikku opened this issue Mar 1, 2022 · 2 comments · May be fixed by #50
Open
1 task

Maintain $parent safely within the core #41

nikku opened this issue Mar 1, 2022 · 2 comments · May be fixed by #50
Labels
backlog Queued in backlog enhancement New feature or request spring cleaning Could be cleaned up one day

Comments

@nikku
Copy link
Member

nikku commented Mar 1, 2022

Is your feature request related to a problem? Please describe

The child to parent pointer $parent is important for model traversal. We do have basic test coverage for it, however we do not ensure that it is being maintained as part of the core. Instead, libraries using it (i.e. moddle-xml, bpmn-js) manually maintain the property in various places. This is error prone and not properly done everywhere.

At best, we do automatically maintain the property:

// $parent set during modeling
const foo = moddle.create('bpmn:ExtensionElements');

// during creation
const blub = { };
foo.values.push(blub); // blub = { $parent: foo }
foo.bar = { }; // bar = { $parent: foo }

// during removal
foo.values.pop(); // blub = { }
blub.$parent = null;
foo.bar = null; // bar = { }

Describe the solution you'd like

  • $parent is maintained automatically by moddle so that I can rely on it

Describe alternatives you've considered

Keep $parent maintenance out of scope for the library.

Additional context

Brought up in the context of bpmn-io/bpmnlint#69 (comment).

@pinussilvestrus
Copy link
Contributor

pinussilvestrus commented Mar 1, 2022

We had a related user request recently: bpmn-io/bpmn-moddle#92

It included an interesting discussion around this (where to maintain what, what's the expectation) => the user expected that this is maintained in the core. 👍

@philippfromme
Copy link

user expected that this is maintained in the core

Good validation! 👍🏻

@pinussilvestrus pinussilvestrus added the backlog Queued in backlog label Mar 3, 2022 — with bpmn-io-tasks
@barmac barmac added the spring cleaning Could be cleaned up one day label Sep 27, 2022
@philippfromme philippfromme self-assigned this Feb 2, 2023
philippfromme added a commit that referenced this issue Feb 3, 2023
@philippfromme philippfromme linked a pull request Feb 3, 2023 that will close this issue
@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed backlog Queued in backlog labels Feb 3, 2023
@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending in progress Currently worked on and removed in progress Currently worked on needs review Review pending labels Feb 6, 2023
@philippfromme philippfromme added the ready Ready to be worked on label Feb 14, 2023 — with bpmn-io-tasks
@philippfromme philippfromme removed the in progress Currently worked on label Feb 14, 2023
@philippfromme philippfromme added the backlog Queued in backlog label Feb 14, 2023 — with bpmn-io-tasks
@philippfromme philippfromme removed the ready Ready to be worked on label Feb 14, 2023
@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed backlog Queued in backlog labels Feb 17, 2023
@philippfromme philippfromme added the backlog Queued in backlog label Feb 28, 2023 — with bpmn-io-tasks
@philippfromme philippfromme removed the in progress Currently worked on label Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Queued in backlog enhancement New feature or request spring cleaning Could be cleaned up one day
Development

Successfully merging a pull request may close this issue.

4 participants