Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minSize validation does not validate correctly on collections #1226

Open
tmanthey opened this issue Feb 18, 2019 · 3 comments
Open

minSize validation does not validate correctly on collections #1226

tmanthey opened this issue Feb 18, 2019 · 3 comments

Comments

@tmanthey
Copy link

Steps to Reproduce

  1. define following domain class

class mytest {
def my_data = "123"
static hasMany = [childItems: mytest]
static constraints = {
childItems minSize: 1
}
}
2. execute the following code

def mytest = new mytest()
mytest.save(failOnError: true, flush: true)
def result = mytest.validate()

Expected Behaviour

According http://docs.grails.org/3.1.1/ref/Constraints/minSize.html

minSize: Sets the minimum size of a collection or number property

Hence result should be false

Actual Behaviour

result is true

Environment Information

  • Operating System: Ubuntu 16.04
  • GORM Version: gormVersion=6.1.10.RELEASE
  • Grails Version (if using Grails): 3.3.8
  • JDK Version: 1.8.0_201
@osscontributor
Copy link
Member

If minSize is set to 2 and you add just 1 item, does validation fail?

@tmanthey
Copy link
Author

If minSize is set to 2 and you add just 1 item, does validation fail?

Yes it fails as expected. Guess you know why you are asking ;-)

@osscontributor
Copy link
Member

Guess you know why you are asking

Correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants