{"action":"created","issue":{"url":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/240","repository_url":"https://api.github.com/repos/JeremySkinner/FluentValidation","labels_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/240/labels{/name}","comments_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/240/comments","events_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/240/events","html_url":"https://github.com/JeremySkinner/FluentValidation/issues/240","id":148086283,"number":240,"title":"Length Validator (string) causes validation failure with string length of 0","user":{"login":"aschaible","id":3843984,"avatar_url":"https://avatars.githubusercontent.com/u/3843984?v=3","gravatar_id":"","url":"https://api.github.com/users/aschaible","html_url":"https://github.com/aschaible","followers_url":"https://api.github.com/users/aschaible/followers","following_url":"https://api.github.com/users/aschaible/following{/other_user}","gists_url":"https://api.github.com/users/aschaible/gists{/gist_id}","starred_url":"https://api.github.com/users/aschaible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aschaible/subscriptions","organizations_url":"https://api.github.com/users/aschaible/orgs","repos_url":"https://api.github.com/users/aschaible/repos","events_url":"https://api.github.com/users/aschaible/events{/privacy}","received_events_url":"https://api.github.com/users/aschaible/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-04-13T14:52:37Z","updated_at":"2016-04-13T15:20:25Z","closed_at":null,"body":"Found this interesting - since we have the NotEmpty validator, my initial expectation was that not including the NotEmpty validator would allow an empty string to pass through.\r\n\r\nIf a user types in a text box, then erases it, most client side frameworks are going to send an empty string, which causes validation to fail.  I feel like NotEmpty should be used to validate 'required' and length should not validate against an empty string.  Unless there is another way to do this?"},"comment":{"url":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/comments/209506353","html_url":"https://github.com/JeremySkinner/FluentValidation/issues/240#issuecomment-209506353","issue_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/240","id":209506353,"user":{"login":"aschaible","id":3843984,"avatar_url":"https://avatars.githubusercontent.com/u/3843984?v=3","gravatar_id":"","url":"https://api.github.com/users/aschaible","html_url":"https://github.com/aschaible","followers_url":"https://api.github.com/users/aschaible/followers","following_url":"https://api.github.com/users/aschaible/following{/other_user}","gists_url":"https://api.github.com/users/aschaible/gists{/gist_id}","starred_url":"https://api.github.com/users/aschaible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aschaible/subscriptions","organizations_url":"https://api.github.com/users/aschaible/orgs","repos_url":"https://api.github.com/users/aschaible/repos","events_url":"https://api.github.com/users/aschaible/events{/privacy}","received_events_url":"https://api.github.com/users/aschaible/received_events","type":"User","site_admin":false},"created_at":"2016-04-13T15:20:25Z","updated_at":"2016-04-13T15:20:25Z","body":"It makes sense, however it seems like this implementation provides less flexibility and an uncovered (but common) validation scenario.  Meaning if a value is supplied, it must be between a min and max.  If not supplied (or length of 0), do not validate.  The builder pattern allows you to combine multiple validators to guard against a 0 length condition, but doesn't seem to provide any mechanism to abort the length validator if the length is 0.\r\n\r\nI added a filter to nullify empty strings - in an HTTP request, null and empty string should be treated the same.\r\n\r\nThe FluentValidation behavior is in contrast with the way AngularJS and JQuery validation works.\r\n\r\nJust something to think about - as always thanks for building the library!"}}