Implement basic validation depending on the property type, e.g. support a regex key in the definition for strings or max/min for integers.

Comments

fmizzell’s picture

I wonder if it could be worth it to make validation configurable and extendable (each property instance can request different types of validation that it wants to use, and modules can define manners in which to validate different data types). So instead of hard coding the types of validation allowed for each data type in their validate() method, validate() can become part of the base class and it can call whatever validation code we are asking for in the definition (or configuration) of a property instance. I hope that makes sense.

fago’s picture

Yep, we definitely want to support custom validation logic. Still, some basic per-type validation helps to easily support basic validation without having to implement this simple logic repeatedly. e.g. this could be the definition for an integer:

array(
 'label' => t('Example count'),
 'type' => 'integer',
 'constraints' => array(
    'min' => 0,
 ));
fago’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.