B
B
Bogdan2018-09-03 09:53:52
Ruby on Rails
Bogdan, 2018-09-03 09:53:52

Dry-validation max-size?

Hello. Tell me please.
I have validation

schema = Dry::Validation.Schema do
      required(:login).filled(:str?, max_size?: 100)
    end

    errors = schema.call({login: ''}).messages

Result
{
    "errors": {
        "login": [
            "must be filled",
            "size cannot be greater than 100"
        ]
    }
}

And for some reason, the validation for the size "size cannot be greater than 100" also gets into the error, although, according to the idea, if the validation for the presence of a value did not pass, then, according to the idea, there should be no validation for the size. Tell me how to fix this? Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question