refactor - use validate function instead of generated validate for each type