DSD-DBS / py-capellambse

A Python 3 headless implementation of the Capella modeling tool.
https://dsd-dbs.github.io/py-capellambse/
Apache License 2.0
53 stars 11 forks source link

Automatically activate/"reference" the required viewpoint when adding new objects #245

Closed Wuestengecko closed 7 months ago

Wuestengecko commented 1 year ago

It's currently possible to add model elements even though the required viewpoint isn't referenced from the model (e.g. the Requirements Viewpoint for reqif.CapellaModule and related types). This curiously does not break the model (as in: make it impossible to load or work with in Capella), however these elements will not show up in the project explorer until the viewpoint is referenced manually.

We should automatically reference the viewpoint when adding new elements that depend on one, similar to adding XML namespaces to the containing fragment.

Wuestengecko commented 7 months ago

This won't be possible, and viewpoint management has to stay somewhat manual. We need to already know the version of the viewpoint and namespace at the point when the element is added, as we don't track which plugin versions are cross-compatible. This could lead to us e.g. enabling the Requirements viewpoint v0.13.0 on a Capella 5.0 model, which simply makes no sense.

403 introduces a couple more checks at save time, which should at least prevent broken models (with missing viewpoints) from being written to disk.