add __serialize method to the Validator