{"action":"created","issue":{"url":"https://api.github.com/repos/NJsonSchema/NJsonSchema/issues/325","repository_url":"https://api.github.com/repos/NJsonSchema/NJsonSchema","labels_url":"https://api.github.com/repos/NJsonSchema/NJsonSchema/issues/325/labels{/name}","comments_url":"https://api.github.com/repos/NJsonSchema/NJsonSchema/issues/325/comments","events_url":"https://api.github.com/repos/NJsonSchema/NJsonSchema/issues/325/events","html_url":"https://github.com/NJsonSchema/NJsonSchema/issues/325","id":210185087,"number":325,"title":"JsconSchema doesn`t validate required property inside anyOf","user":{"login":"dynamicmoodz","id":18452027,"avatar_url":"https://avatars.githubusercontent.com/u/18452027?v=3","gravatar_id":"","url":"https://api.github.com/users/dynamicmoodz","html_url":"https://github.com/dynamicmoodz","followers_url":"https://api.github.com/users/dynamicmoodz/followers","following_url":"https://api.github.com/users/dynamicmoodz/following{/other_user}","gists_url":"https://api.github.com/users/dynamicmoodz/gists{/gist_id}","starred_url":"https://api.github.com/users/dynamicmoodz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dynamicmoodz/subscriptions","organizations_url":"https://api.github.com/users/dynamicmoodz/orgs","repos_url":"https://api.github.com/users/dynamicmoodz/repos","events_url":"https://api.github.com/users/dynamicmoodz/events{/privacy}","received_events_url":"https://api.github.com/users/dynamicmoodz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-02-24T23:27:52Z","updated_at":"2017-02-25T12:40:56Z","closed_at":null,"body":"I have this json schema which is being used in the code below.\r\n{\r\n  \"definitions\": {\r\n    \"Test\": {\r\n      \"id\": \"Jsonschemas/\",\r\n      \"type\": \"object\",\r\n      \"properties\": {\r\n        \"url\": {\r\n          \"type\": \"string\"\r\n        },\r\n        \"canceledOnDate\": {\r\n          \"type\": \"string\"\r\n        },\r\n        \"address\": {\r\n          \"$ref\": \"address.json#/definitions/address\"\r\n        },\r\n        \"coordinates\": {\r\n          \"$ref\": \"coordinates.json#/definitions/coordinates\"\r\n        }\r\n      },\r\n      \"additionalProperties\": false,\r\n      \"required\": [\"canceledOnDate\" ],\r\n      \"anyOf\": [\r\n        { \"required\": [ \"address\" ] },\r\n        { \"required\": [ \"coordinates\" ] }\r\n      ]\r\n    }\r\n  }\r\n}\r\n\r\nI have this C# code which is using JsonSchema4.\r\n\r\nJsonSchema4 schema = new JsonSchema4();   \r\nschema = await JsonSchema4.FromFileAsync(Path.Combine(HttpContext.Current.Server.MapPath(\"~\"), @\"JsonSchema/Test.json\"));\r\nschema.Validate(actualJsonData);\r\n\r\nI am expecting that based on the schema if I dont provide either address or cocrdinates, the Validate method should return me error. But it doesn`t validate the required field in anyOf at all. The validation always passes even if address and coordinates both are not provided.\r\n\r\nIs it not supported with JsonSchema4? I am looking for help to fix this problem or a work around to fix this issue."},"comment":{"url":"https://api.github.com/repos/NJsonSchema/NJsonSchema/issues/comments/282481554","html_url":"https://github.com/NJsonSchema/NJsonSchema/issues/325#issuecomment-282481554","issue_url":"https://api.github.com/repos/NJsonSchema/NJsonSchema/issues/325","id":282481554,"user":{"login":"rsuter","id":2603405,"avatar_url":"https://avatars.githubusercontent.com/u/2603405?v=3","gravatar_id":"","url":"https://api.github.com/users/rsuter","html_url":"https://github.com/rsuter","followers_url":"https://api.github.com/users/rsuter/followers","following_url":"https://api.github.com/users/rsuter/following{/other_user}","gists_url":"https://api.github.com/users/rsuter/gists{/gist_id}","starred_url":"https://api.github.com/users/rsuter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsuter/subscriptions","organizations_url":"https://api.github.com/users/rsuter/orgs","repos_url":"https://api.github.com/users/rsuter/repos","events_url":"https://api.github.com/users/rsuter/events{/privacy}","received_events_url":"https://api.github.com/users/rsuter/received_events","type":"User","site_admin":false},"created_at":"2017-02-25T12:40:56Z","updated_at":"2017-02-25T12:40:56Z","body":"Define the properties here\r\n\r\n    { \"required\": [ \"address\" ] },\r\n\r\nLike\r\n\r\n    { \"required\": [ \"address\" ], \"properties\": { } },"}}
{"actor":{"display_login":"rsuter"}}