{"action":"closed","issue":{"url":"https://api.github.com/repos/jquense/yup/issues/83","repository_url":"https://api.github.com/repos/jquense/yup","labels_url":"https://api.github.com/repos/jquense/yup/issues/83/labels{/name}","comments_url":"https://api.github.com/repos/jquense/yup/issues/83/comments","events_url":"https://api.github.com/repos/jquense/yup/issues/83/events","html_url":"https://github.com/jquense/yup/issues/83","id":214551603,"number":83,"title":"Nested schema with required","user":{"login":"cheryly279","id":1900816,"avatar_url":"https://avatars0.githubusercontent.com/u/1900816?v=3","gravatar_id":"","url":"https://api.github.com/users/cheryly279","html_url":"https://github.com/cheryly279","followers_url":"https://api.github.com/users/cheryly279/followers","following_url":"https://api.github.com/users/cheryly279/following{/other_user}","gists_url":"https://api.github.com/users/cheryly279/gists{/gist_id}","starred_url":"https://api.github.com/users/cheryly279/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cheryly279/subscriptions","organizations_url":"https://api.github.com/users/cheryly279/orgs","repos_url":"https://api.github.com/users/cheryly279/repos","events_url":"https://api.github.com/users/cheryly279/events{/privacy}","received_events_url":"https://api.github.com/users/cheryly279/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-03-15T23:01:12Z","updated_at":"2017-07-04T15:42:26Z","closed_at":"2017-07-04T15:42:26Z","body":"Hi,\r\n\r\nI have a nested schema like this:\r\n\r\n```\r\nschema: yup.object().shape({\r\n    source: yup.object().shape({\r\n        name: yup.string().required()\r\n    }).required()\r\n})\r\n```\r\n\r\nThat is, indicate that source is required and then inside of it, name is required. This seems to work mostly fine. When source.name is not there, the error path is 'source.name' but when source is not there at all the path is still 'source.name' when I would expect it to be just 'source'. As well, if I modify the schema slightly to make source not required:\r\n\r\n```\r\nschema: yup.object().shape({\r\n    source: yup.object().shape({\r\n        name: yup.string().required()\r\n    })\r\n})\r\n```\r\n\r\nThe validation fails even when source is not there. How would I indicate that source is not required, but that if it is there, name must be inside it?"}}
{"actor":{"display_login":"jquense"}}