we are currently trying to extend the knime.extension.Condition with a IsNotEmpty class, which should check if a value of a Parameter in a ParameterGroup is not empty.
However, we are not quite sure how the to_dict method works. The predefined OneOf condition returns a dict with a oneOf key and a list of {"const": value} pairs. But how is that used?
The to_dict method currently has to return a JSONForms schema compatible dictionary which is used as JSONForms rule body. So if you want to make sure a field is not empty you could come up with the appropriate JSONForms rule.
Unfortunately JSONForms rules are not super well documented, so I can’t tell you from the top of my head how an notEmpty condition could be implemented.
Hi @graudata,
if you do not want to dive deep into the JSON Forms (and possibly our Node dialog implementation of it), could you just reverse the effect and use the OneOf rule with [""]?
Yes the OneOf with [""] and a negation works. Unfortunately it raises the error ValueError: Can't find scope for parameter if returning [self._subject.my_input] as a subjects list, for example (as it is a parameter group). That is probably intended and what you mentioned in the documentation where “rules can only depend on parameters on the same level, not in a child or parent parameter group” ?