Validation plugin #3259
Replies: 2 comments 1 reply
-
Hi @mikekidner, Validation can be done either inside the Gaphor ui, or as an external command. I think it depends on how you want validation to happen: instantly or on demand (e.g. a keyboard shortcut). Either way, I guess you'll have to implement the rules in Python (or build an interpreter in python). I think it's a good idea to be able to run the validation from the command line in any case, so you can create a CI job and validate the model. To include a validation service in the (ui) application you define one as an entry point. You can do validation either instantly (like sanitizer service does, or as a command (like the hello world plugin). It's a lengthy set of rules you shared, so it may not be feasible to to validation instantly. And how to present the validation results? As a list in a separate window? Another idea for validation is to define those in CSS. Although I expect that will only work for only the simple rules. |
Beta Was this translation helpful? Give feedback.
-
I've simplified the above into a checker and a list of rules. An example of rules look like this:
The intent is that the rule set can be saved as json, making it user configurable. There are probably nicer ways than this that avoid calling eval() on a lambda string, but this seems to work well. Each rule becomes a ValidationRule, and then the apply() method evaluates the rule itself. like this:
The ValidationRule object looks like this:
Any comments on this approach or scalability to a plugin would be welcome. |
Beta Was this translation helpful? Give feedback.
-
Has anyone considered how the validation of a model might be achieved?
How to define rules? -> can a model be used to do this?
How users can modify/exclude etc the rules?
How to present results ?
The SAIC list of rules gives a starting point, (but are too perhaps specific to other tools) but would need to be 'translated' to refer to gaphor element attributes etc.
SAIC DE Validation Rules v26.xlsx
Beta Was this translation helpful? Give feedback.
All reactions