prmr / JetUML

A desktop application for fast UML diagramming.
GNU General Public License v3.0
620 stars 121 forks source link

Refactor Semantic Validation #495

Closed prmr closed 1 year ago

prmr commented 1 year ago

JetUML validates that diagrams created in the application are semantically valid. This is currently support by the DiagramBuilder functionality, which prevents the addition of nodes and edges that violate semantic constraints. There are three problems with the current design:

  1. Diagram files loaded in are not semantically validated. Therefore, it is possible to hand-craft (or used tools) to make a file that describes an invalid diagram, and load it in.
  2. The constraint validation code cannot easily be reused to do batch validation of existing diagrams.
  3. The constraint validation code does not easily support providing useful error messages when validation rules are not respected.

We need to refactor the constraint validation code so that it is more modular, reusable, and extensive to support the above scenarios.

The current design is to have the following workflow for all validation scenarios:

  1. Create or update a diagram without any constrain validation;
  2. Run all the validation rules, record violations
  3. If there are any violations, undo the last update command.