Declarative validation for javascript