{"action":"created","issue":{"url":"https://api.github.com/repos/phramework/validate/issues/19","repository_url":"https://api.github.com/repos/phramework/validate","labels_url":"https://api.github.com/repos/phramework/validate/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/phramework/validate/issues/19/comments","events_url":"https://api.github.com/repos/phramework/validate/issues/19/events","html_url":"https://github.com/phramework/validate/issues/19","id":155774746,"number":19,"title":"Design and implement x-visibility directive for ObjectValidators","user":{"login":"nohponex","id":432379,"avatar_url":"https://avatars.githubusercontent.com/u/432379?v=3","gravatar_id":"","url":"https://api.github.com/users/nohponex","html_url":"https://github.com/nohponex","followers_url":"https://api.github.com/users/nohponex/followers","following_url":"https://api.github.com/users/nohponex/following{/other_user}","gists_url":"https://api.github.com/users/nohponex/gists{/gist_id}","starred_url":"https://api.github.com/users/nohponex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nohponex/subscriptions","organizations_url":"https://api.github.com/users/nohponex/orgs","repos_url":"https://api.github.com/users/nohponex/repos","events_url":"https://api.github.com/users/nohponex/events{/privacy}","received_events_url":"https://api.github.com/users/nohponex/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/phramework/validate/labels/new%20feature","name":"new feature","color":"FF007F"}],"state":"open","locked":false,"assignee":{"login":"nohponex","id":432379,"avatar_url":"https://avatars.githubusercontent.com/u/432379?v=3","gravatar_id":"","url":"https://api.github.com/users/nohponex","html_url":"https://github.com/nohponex","followers_url":"https://api.github.com/users/nohponex/followers","following_url":"https://api.github.com/users/nohponex/following{/other_user}","gists_url":"https://api.github.com/users/nohponex/gists{/gist_id}","starred_url":"https://api.github.com/users/nohponex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nohponex/subscriptions","organizations_url":"https://api.github.com/users/nohponex/orgs","repos_url":"https://api.github.com/users/nohponex/repos","events_url":"https://api.github.com/users/nohponex/events{/privacy}","received_events_url":"https://api.github.com/users/nohponex/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2016-05-19T16:04:24Z","updated_at":"2016-05-19T16:04:45Z","closed_at":null,"body":"This directive is required to enable properties based on specific values of other fields.\r\n\r\nThis feature could be implemented using JSON schema v4 `oneOf` directive but it's difficult to describe this schema to clients in order to create the visual components.\r\n\r\nDefinition in JSON\r\n```json\r\n{\r\n        \"type\": \"object\",\r\n        \"title\": \"Object Title\",\r\n        \"description\": \"Object Description\",\r\n        \"properties\": {\r\n            \"field1\": {\r\n                \"type\": \"enum\",\r\n                \"order\": 1,\r\n                \"title\": \"field1 title\",\r\n                \"description\": \"field1 description\",\r\n                \"enum\": [\r\n                    \"1\",\r\n                    \"2\",\r\n                    \"3\",\r\n                    \"4\",\r\n                    \"5\"\r\n                ]\r\n            },\r\n            \"field2\": {\r\n                \"type\": \"number\",\r\n                \"order\": 1,\r\n                \"title\": \"field2 title\",\r\n                \"description\": \"field2 description\",\r\n                \"minimum\": 0,\r\n                \"maximum\": 100\r\n            }\r\n        },\r\n        \"required\": [\r\n            \"field1\"\r\n        ],\r\n        \"x-visibility\": {\r\n            \"field2\": [\r\n                \"member\",\r\n                \"field1\",\r\n                [\r\n                    \"1\",\r\n                    \"2\",\r\n                    \"3\"\r\n                ]\r\n            ]\r\n        }\r\n    }\r\n```\r\n\r\nDefinition in PHP\r\n```php\r\n$validator = new ObjectValidator(\r\n            (object) [\r\n                'field1' => new EnumValidator(\r\n                    ['yes', 'no']\r\n                ),\r\n                'field2' => new StringValidator(),\r\n            ],\r\n            ['field1', 'field2'],\r\n            false,\r\n            0,\r\n            null,\r\n            null,\r\n            (object) [\r\n                'field2' => [\r\n                    'member',\r\n                    'field1',\r\n                    ['yes']\r\n                ]\r\n            ]\r\n        );\r\n```"},"comment":{"url":"https://api.github.com/repos/phramework/validate/issues/comments/220372104","html_url":"https://github.com/phramework/validate/issues/19#issuecomment-220372104","issue_url":"https://api.github.com/repos/phramework/validate/issues/19","id":220372104,"user":{"login":"nohponex","id":432379,"avatar_url":"https://avatars.githubusercontent.com/u/432379?v=3","gravatar_id":"","url":"https://api.github.com/users/nohponex","html_url":"https://github.com/nohponex","followers_url":"https://api.github.com/users/nohponex/followers","following_url":"https://api.github.com/users/nohponex/following{/other_user}","gists_url":"https://api.github.com/users/nohponex/gists{/gist_id}","starred_url":"https://api.github.com/users/nohponex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nohponex/subscriptions","organizations_url":"https://api.github.com/users/nohponex/orgs","repos_url":"https://api.github.com/users/nohponex/repos","events_url":"https://api.github.com/users/nohponex/events{/privacy}","received_events_url":"https://api.github.com/users/nohponex/received_events","type":"User","site_admin":false},"created_at":"2016-05-19T16:04:45Z","updated_at":"2016-05-19T16:04:45Z","body":"https://github.com/phramework/validate/commit/bd819b8022af492f2a9e9ea9725bf926219626a3"}}