I have a question about the grammar for the declarative validation of a custom rule. ValidateCustomGrammar is implemented so that either "message" or "messageKey" attributes are required in the @ValidateCustomRule annotation.
The validation-rules.xml that a user creates for the rule must contain a msg attribute on the <validator> element. The msg attribute is "a generic message key to use when this validator fails. It can be overridden by the 'msg' element for a specific field." So if the specific form field does not include a message, then the message key defined in the <validator> element would be used. An example of this case is the customvalidator in the netui-samples. At the moment the external form bean does not go through the grammer checker (see BEEHIVE-1127) but it does generate the validation.xml without having the message key for the specific fields. Running the sample works because the message key is used from the <validator> element defined in the custom-validator-rules.xml of the sample. When the external form bean of this sample goes through the checker it will fail, unless the messageKey is added to the @ValidateCustomRule annotations on the fields. Would it makes sense to remove the requirement that message or messageKey exist in the ValidateCustomGrammar to give users the option that they just define the key in the validator-rules.xml or is it better that they continue to always explicitly define the message key? Just curious. Kind regards, Carlin
