GitHub ReleaseEvent at 2014-08-15 06:02:29
Repository: jsonschema
Actor: henrysher
Payload: {"action":"published","release":{"url":"https://api.github.com/repos/henrysher/jsonschema/releases/493004","assets_url":"https://api.github.com/repos/henrysher/jsonschema/releases/493004/assets","upload_url":"https://uploads.github.com/repos/henrysher/jsonschema/releases/493004/assets{?name}","html_url":"https://github.com/henrysher/jsonschema/releases/tag/2.3.0p2","id":493004,"tag_name":"2.3.0p2","target_commitish":"for-ianitor","name":"Add a new validator \"anyItems\"","draft":false,"author":{"login":"henrysher","id":65181,"avatar_url":"https://avatars.githubusercontent.com/u/65181?v=2","gravatar_id":"b4ab79b787447b5af53b7a2c6eb629a3","url":"https://api.github.com/users/henrysher","html_url":"https://github.com/henrysher","followers_url":"https://api.github.com/users/henrysher/followers","following_url":"https://api.github.com/users/henrysher/following{/other_user}","gists_url":"https://api.github.com/users/henrysher/gists{/gist_id}","starred_url":"https://api.github.com/users/henrysher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrysher/subscriptions","organizations_url":"https://api.github.com/users/henrysher/orgs","repos_url":"https://api.github.com/users/henrysher/repos","events_url":"https://api.github.com/users/henrysher/events{/privacy}","received_events_url":"https://api.github.com/users/henrysher/received_events","type":"User","site_admin":false},"prerelease":true,"created_at":"2014-08-15T06:00:17Z","published_at":"2014-08-15T06:02:29Z","assets":[],"tarball_url":"https://api.github.com/repos/henrysher/jsonschema/tarball/2.3.0p2","zipball_url":"https://api.github.com/repos/henrysher/jsonschema/zipball/2.3.0p2","body":"**anyItems** is a new validator.\r\n\r\nCurrent JSON schema does not support the situation that one or some item(s) of the array matches the schema but others not. **anyItems** validator is created for that scenario.\r\n\r\nThere are also two ways in which arrays are generally used in JSON:\r\n * List validation: a sequence of arbitrary length where **any** item(s) matches the same schema.\r\n * Tuple validation: a sequence of fixed length where **any** item(s) matches **all** the different schema.\r\n\r\n**List validation**\r\n```json\r\n{\r\n    \"Snapshots\": [\r\n        {\r\n            \"type\": \"object\",\r\n            \"properties\": {\r\n                \"Tags\": {\r\n                    \"type\": \"array\",\r\n                    \"anyitems\": {\r\n                        \"type\": \"object\",\r\n                        \"properties\": {\r\n                            \"Key\": {\r\n                                \"enum\": [\r\n                                    \"Role\"\r\n                                ]\r\n                            },\r\n                            \"Value\": {\r\n                                \"enum\": [\r\n                                    \"SplunkMaster\"\r\n                                ]\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    ]\r\n}\r\n```\r\n\r\n**Tuple validation**\r\n```json\r\n{\r\n    \"Snapshots\": [\r\n        {\r\n            \"type\": \"object\",\r\n            \"properties\": {\r\n                \"Tags\": {\r\n                    \"type\": \"array\",\r\n                    \"anyItems\": [\r\n                        {\r\n                            \"type\": \"object\",\r\n                            \"properties\": {\r\n                                \"Key\": {\r\n                                    \"enum\": [\r\n                                        \"Role\"\r\n                                    ]\r\n                                },\r\n                                \"Value\": {\r\n                                    \"enum\": [\r\n                                        \"SplunkMaster\"\r\n                                    ]\r\n                                }\r\n                            }\r\n                        },\r\n                        {\r\n                            \"type\": \"object\",\r\n                            \"properties\": {\r\n                                \"Key\": {\r\n                                    \"enum\": [\r\n                                        \"Owner\"\r\n                                    ]\r\n                                },\r\n                                \"Value\": {\r\n                                    \"enum\": [\r\n                                        \"Ops\"\r\n                                    ]\r\n                                }\r\n                            }\r\n                        }\r\n                    ]\r\n                }\r\n            }\r\n        }\r\n    ]\r\n}\r\n```"}}