integer validator using more composition to avoid magic
simplified custom validator