{"action":"created","issue":{"url":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/1123","repository_url":"https://api.github.com/repos/JeremySkinner/FluentValidation","labels_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/1123/labels{/name}","comments_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/1123/comments","events_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/1123/events","html_url":"https://github.com/JeremySkinner/FluentValidation/issues/1123","id":444514988,"node_id":"MDU6SXNzdWU0NDQ1MTQ5ODg=","number":1123,"title":"[Feature] RuleForEach Property builder","user":{"login":"jzabroski","id":447485,"node_id":"MDQ6VXNlcjQ0NzQ4NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/447485?v=4","gravatar_id":"","url":"https://api.github.com/users/jzabroski","html_url":"https://github.com/jzabroski","followers_url":"https://api.github.com/users/jzabroski/followers","following_url":"https://api.github.com/users/jzabroski/following{/other_user}","gists_url":"https://api.github.com/users/jzabroski/gists{/gist_id}","starred_url":"https://api.github.com/users/jzabroski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzabroski/subscriptions","organizations_url":"https://api.github.com/users/jzabroski/orgs","repos_url":"https://api.github.com/users/jzabroski/repos","events_url":"https://api.github.com/users/jzabroski/events{/privacy}","received_events_url":"https://api.github.com/users/jzabroski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2019-05-15T15:49:10Z","updated_at":"2019-05-15T16:50:20Z","closed_at":null,"author_association":"NONE","body":"I think the following might be much more pleasant to write:\r\n💛 \r\n```csharp\r\nRuleForEach(s => s.Lines)\r\n                .Property(s => s.DollarAmount)\r\n                .GreaterThanOrEqualTo(0);\r\n```\r\n\r\n❌ \r\n```csharp\r\nRuleForEach(s => s.Lines)\r\n                .Must(s => s.DollarAmount > 0)\r\n                .WithMessage((s, x) => $\"LineNumber {s.LineNumber} {nameof(s.Lines)} must have {x.DollarAmount} greater than 0.\");\r\n```\r\n\r\nGranted, it's not 1:1 and the bottom example has some additional context, but you get the idea of basically letting users \"recurse down an object model\" and re-use the already unit tested FluentValidation validation rules.\r\n\r\nBy the way, Jeremy, the overloads on WithMessage is a nice touch!  It's pretty amazing to use a library and wonder \"gee, I wonder if I just type it this way if it will just work\", and IT DOES!"},"comment":{"url":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/comments/492734487","html_url":"https://github.com/JeremySkinner/FluentValidation/issues/1123#issuecomment-492734487","issue_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/1123","id":492734487,"node_id":"MDEyOklzc3VlQ29tbWVudDQ5MjczNDQ4Nw==","user":{"login":"jzabroski","id":447485,"node_id":"MDQ6VXNlcjQ0NzQ4NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/447485?v=4","gravatar_id":"","url":"https://api.github.com/users/jzabroski","html_url":"https://github.com/jzabroski","followers_url":"https://api.github.com/users/jzabroski/followers","following_url":"https://api.github.com/users/jzabroski/following{/other_user}","gists_url":"https://api.github.com/users/jzabroski/gists{/gist_id}","starred_url":"https://api.github.com/users/jzabroski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzabroski/subscriptions","organizations_url":"https://api.github.com/users/jzabroski/orgs","repos_url":"https://api.github.com/users/jzabroski/repos","events_url":"https://api.github.com/users/jzabroski/events{/privacy}","received_events_url":"https://api.github.com/users/jzabroski/received_events","type":"User","site_admin":false},"created_at":"2019-05-15T16:50:20Z","updated_at":"2019-05-15T16:50:20Z","author_association":"NONE","body":"I'll have to do some digging; I was initially thinking I could use the same trick WithMessage is using, but in reverse.  In effect the builder is accumulating phantom information that isn't useful to the current builder, but could be useful for other builders (e.g., the next property).\r\n\r\nAm I missing something obvious?"}}
{"actor":{"display_login":"jzabroski"}}