{"action":"created","issue":{"url":"https://api.github.com/repos/Keats/validator/issues/51","repository_url":"https://api.github.com/repos/Keats/validator","labels_url":"https://api.github.com/repos/Keats/validator/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/Keats/validator/issues/51/comments","events_url":"https://api.github.com/repos/Keats/validator/issues/51/events","html_url":"https://github.com/Keats/validator/issues/51","id":330406096,"node_id":"MDU6SXNzdWUzMzA0MDYwOTY=","number":51,"title":"Bug:  Nested type, where inner type field is an Option<InnerType>, and has a value, is failing to validate","user":{"login":"Dowwie","id":2601236,"node_id":"MDQ6VXNlcjI2MDEyMzY=","avatar_url":"https://avatars0.githubusercontent.com/u/2601236?v=4","gravatar_id":"","url":"https://api.github.com/users/Dowwie","html_url":"https://github.com/Dowwie","followers_url":"https://api.github.com/users/Dowwie/followers","following_url":"https://api.github.com/users/Dowwie/following{/other_user}","gists_url":"https://api.github.com/users/Dowwie/gists{/gist_id}","starred_url":"https://api.github.com/users/Dowwie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dowwie/subscriptions","organizations_url":"https://api.github.com/users/Dowwie/orgs","repos_url":"https://api.github.com/users/Dowwie/repos","events_url":"https://api.github.com/users/Dowwie/events{/privacy}","received_events_url":"https://api.github.com/users/Dowwie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-07T19:32:00Z","updated_at":"2018-06-08T09:20:59Z","closed_at":null,"author_association":"NONE","body":"In the following example, an incorrect postal_cd is provided.  I expected validate() to raise a ValidationError but instead returned Ok(()).  Is this a bug?\r\n\r\n```rust\r\nextern crate validator;\r\nextern crate failure;\r\n#[macro_use] extern crate validator_derive;\r\n\r\nuse validator::{Validate, ValidationError};\r\nuse failure::Error;\r\n\r\n#[derive(Validate)]\r\npub struct Address {\r\n    pub street: String,\r\n    #[validate(length(min = \"1\", max = \"5\"))]\r\n    pub postal_cd: String\r\n}\r\n\r\n#[derive(Validate)]\r\npub struct PartyInfo {\r\n    #[validate(length(min = \"1\", max = \"5\"))]\r\n    pub first_name: Option<String>,\r\n    #[validate(length(min = \"1\", max = \"10\"))]\r\n    pub last_name: Option<String>,\r\n    pub address: Option<Address>\r\n}\r\n\r\nfn main() -> Result<(), Error>{\r\n    let addr = Address {street: \"123 main st\".to_string(),\r\n                        postal_cd: \"0703000000000000\".to_string()};\r\n        let party = PartyInfo {first_name: Some(\"Darin\".to_string()),\r\n                           last_name: Some(\"Gordon\".to_string()),\r\n                           address: Some(addr)};\r\n        let check = party.validate()?;\r\n    println!(\"check is: {:?}\", check);\r\n\r\n    Ok(())\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/Keats/validator/issues/comments/395703453","html_url":"https://github.com/Keats/validator/issues/51#issuecomment-395703453","issue_url":"https://api.github.com/repos/Keats/validator/issues/51","id":395703453,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NTcwMzQ1Mw==","user":{"login":"Keats","id":680355,"node_id":"MDQ6VXNlcjY4MDM1NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/680355?v=4","gravatar_id":"","url":"https://api.github.com/users/Keats","html_url":"https://github.com/Keats","followers_url":"https://api.github.com/users/Keats/followers","following_url":"https://api.github.com/users/Keats/following{/other_user}","gists_url":"https://api.github.com/users/Keats/gists{/gist_id}","starred_url":"https://api.github.com/users/Keats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Keats/subscriptions","organizations_url":"https://api.github.com/users/Keats/orgs","repos_url":"https://api.github.com/users/Keats/repos","events_url":"https://api.github.com/users/Keats/events{/privacy}","received_events_url":"https://api.github.com/users/Keats/received_events","type":"User","site_admin":false},"created_at":"2018-06-08T09:20:59Z","updated_at":"2018-06-08T09:20:59Z","author_association":"OWNER","body":"See #31 \r\n\r\nI'm not even entirely sure how I could detect that a field is implementing `validate`, I would need to find the struct definition somehow and check the attributes. The second part is easy but the first...\r\nIf anyone has an idea, that's definitely something I want"}}
{"actor":{"display_login":"Keats"}}