eclipse-viatra / org.eclipse.viatra

Main components of the VIATRA framework
https://eclipse.dev/viatra
Eclipse Public License 2.0
0 stars 1 forks source link

Make @Constraint parameters optional #172

Open bergmanngabor opened 1 month ago

bergmanngabor commented 1 month ago

The annotation validator for @Constraint should allow most annotation arguments to be skipped. https://github.com/eclipse-viatra/org.eclipse.viatra/blob/master/addon/plugins/org.eclipse.viatra.addon.validation.runtime.validation/src/org/eclipse/viatra/addon/validation/runtime/annotation/ConstraintAnnotationValidator.java

Specifically,

ujhelyiz commented 1 month ago

I agree with the first suggestion about having a default severity of error.

However, I don't believe an empty string as the message is meaningful in any way. E.g. it would result in Eclipse displaying an error marker without any description in the editor and the markers view that is not usable for end-users.

bergmanngabor commented 1 month ago

Ok, then how about the default message being "Violation of "?

ujhelyiz commented 1 month ago

We have discussed the options in person and found the following ways to handle the issue:

  1. I am fine with the default suggestion only if we can still mark the missing message with a warning severity.
  2. Based on the use case, removing the org.eclipse.viatra.addon.validation.runtime.validation fragment from the installation would avoid the entire issue.
  3. Fixing #126 would provide an appropriate workaround for the issue Gábor mentioned.

I'd prefer option 2 or 3, but I can live with option 1 if they are inappropriate.