Setting the length constraint using size instead of minSize and maxSize which is used for collections