{"action":"created","comment":{"url":"https://api.github.com/repos/oasis-open/cti-stix-validator/pulls/comments/137685503","pull_request_review_id":61386268,"id":137685503,"diff_hunk":"@@ -0,0 +1,50 @@\n+import copy\n+import json\n+from . import ValidatorTest\n+from .. import validate_string\n+\n+\n+MULTI_OBJ_JSON = \"\"\"\n+[\n+    {\n+      \"type\": \"attack-pattern\",\n+      \"id\": \"attack-pattern--0c7b5b88-8ff7-4a4d-aa9d-feb398cd0061\",\n+      \"created\": \"2016-02-12T08:17:27.000Z\",\n+      \"modified\": \"2016-02-12T08:17:27.000Z\",\n+      \"name\": \"Spear Phishing\",\n+      \"description\": \"...\",\n+      \"external_references\": [\n+        {\n+          \"source_name\": \"capec\",\n+          \"external_id\": \"CAPEC-463\"\n+        }\n+      ]\n+    },\n+\n+    {\n+      \"type\": \"identity\",\n+      \"id\": \"identity--2d1c6ab3-5e4e-48ac-a32b-f0c01c2836a8\",\n+      \"created\": \"2014-08-08T15:50:10.983Z\",\n+      \"modified\": \"2014-08-08T15:50:10.983Z\",\n+      \"name\": \"ACME Widget, Inc.\",\n+      \"identity_class\": \"organization\"\n+    }\n+]\n+\"\"\"\n+\n+class MultiObjTestCases(ValidatorTest):\n+    valid_objs = json.loads(MULTI_OBJ_JSON)\n+\n+    def test_both_valid(self):\n+        obj_results = validate_string(MULTI_OBJ_JSON)\n+        self.assertEqual(len(obj_results), 2)\n+        self.assertTrue(all(r.is_valid for r in obj_results))\n+\n+    def test_one_valid_one_invalid(self):\n+        objs = copy.deepcopy(self.valid_objs)\n+        objs[1][\"id\"] = objs[1][\"id\"].replace(\"identity\", \"abc\")\n+        obj_results = validate_string(json.dumps(objs))","path":"stix2validator/test/multi_obj_test.py","position":46,"original_position":46,"commit_id":"30558d244620731facd792673787b481303641b0","original_commit_id":"30558d244620731facd792673787b481303641b0","user":{"login":"chisholm","id":1652600,"avatar_url":"https://avatars0.githubusercontent.com/u/1652600?v=4","gravatar_id":"","url":"https://api.github.com/users/chisholm","html_url":"https://github.com/chisholm","followers_url":"https://api.github.com/users/chisholm/followers","following_url":"https://api.github.com/users/chisholm/following{/other_user}","gists_url":"https://api.github.com/users/chisholm/gists{/gist_id}","starred_url":"https://api.github.com/users/chisholm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chisholm/subscriptions","organizations_url":"https://api.github.com/users/chisholm/orgs","repos_url":"https://api.github.com/users/chisholm/repos","events_url":"https://api.github.com/users/chisholm/events{/privacy}","received_events_url":"https://api.github.com/users/chisholm/received_events","type":"User","site_admin":false},"body":"I didn't like having to `json.dumps` back to a string again here.  The API is inconsistent: we have functions (in validator.py) to validate files, strings, text streams (something I added), and parsed JSON.  The first three have the same behavior, catching a `SchemaInvalidError` and appending an error result; the last one doesn't.  It will raise the exception.  I didn't want all the try-catch junk in the test case, so I converted back to a string so I could call a function which deals with the exception.  I think we need consistent behavior across all of these validation functions.  It would be nice if I could call a validation function with `objs` directly.","created_at":"2017-09-08T00:15:06Z","updated_at":"2017-09-08T00:15:06Z","html_url":"https://github.com/oasis-open/cti-stix-validator/pull/36#discussion_r137685503","pull_request_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/pulls/36","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/oasis-open/cti-stix-validator/pulls/comments/137685503"},"html":{"href":"https://github.com/oasis-open/cti-stix-validator/pull/36#discussion_r137685503"},"pull_request":{"href":"https://api.github.com/repos/oasis-open/cti-stix-validator/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/oasis-open/cti-stix-validator/pulls/36","id":139929919,"html_url":"https://github.com/oasis-open/cti-stix-validator/pull/36","diff_url":"https://github.com/oasis-open/cti-stix-validator/pull/36.diff","patch_url":"https://github.com/oasis-open/cti-stix-validator/pull/36.patch","issue_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/issues/36","number":36,"state":"open","locked":false,"title":"Changes to enable validation of files with lists of objects","user":{"login":"chisholm","id":1652600,"avatar_url":"https://avatars0.githubusercontent.com/u/1652600?v=4","gravatar_id":"","url":"https://api.github.com/users/chisholm","html_url":"https://github.com/chisholm","followers_url":"https://api.github.com/users/chisholm/followers","following_url":"https://api.github.com/users/chisholm/following{/other_user}","gists_url":"https://api.github.com/users/chisholm/gists{/gist_id}","starred_url":"https://api.github.com/users/chisholm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chisholm/subscriptions","organizations_url":"https://api.github.com/users/chisholm/orgs","repos_url":"https://api.github.com/users/chisholm/repos","events_url":"https://api.github.com/users/chisholm/events{/privacy}","received_events_url":"https://api.github.com/users/chisholm/received_events","type":"User","site_admin":false},"body":"(I felt like I was stomping over the code more when I wrote this; that's why the branch name is \"*_stomped\".)\r\n\r\nSo this is a first cut.  I want to add more comments inline with the code too, within this PR, to help explain changes.","created_at":"2017-09-08T00:01:18Z","updated_at":"2017-09-08T00:15:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f61cd499ac098dffb6be191e6e16341d49d755fd","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/pulls/36/commits","review_comments_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/pulls/36/comments","review_comment_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/issues/36/comments","statuses_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/statuses/30558d244620731facd792673787b481303641b0","head":{"label":"chisholm:obj_lists_stomped","ref":"obj_lists_stomped","sha":"30558d244620731facd792673787b481303641b0","user":{"login":"chisholm","id":1652600,"avatar_url":"https://avatars0.githubusercontent.com/u/1652600?v=4","gravatar_id":"","url":"https://api.github.com/users/chisholm","html_url":"https://github.com/chisholm","followers_url":"https://api.github.com/users/chisholm/followers","following_url":"https://api.github.com/users/chisholm/following{/other_user}","gists_url":"https://api.github.com/users/chisholm/gists{/gist_id}","starred_url":"https://api.github.com/users/chisholm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chisholm/subscriptions","organizations_url":"https://api.github.com/users/chisholm/orgs","repos_url":"https://api.github.com/users/chisholm/repos","events_url":"https://api.github.com/users/chisholm/events{/privacy}","received_events_url":"https://api.github.com/users/chisholm/received_events","type":"User","site_admin":false},"repo":{"id":102796771,"name":"cti-stix-validator","full_name":"chisholm/cti-stix-validator","owner":{"login":"chisholm","id":1652600,"avatar_url":"https://avatars0.githubusercontent.com/u/1652600?v=4","gravatar_id":"","url":"https://api.github.com/users/chisholm","html_url":"https://github.com/chisholm","followers_url":"https://api.github.com/users/chisholm/followers","following_url":"https://api.github.com/users/chisholm/following{/other_user}","gists_url":"https://api.github.com/users/chisholm/gists{/gist_id}","starred_url":"https://api.github.com/users/chisholm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chisholm/subscriptions","organizations_url":"https://api.github.com/users/chisholm/orgs","repos_url":"https://api.github.com/users/chisholm/repos","events_url":"https://api.github.com/users/chisholm/events{/privacy}","received_events_url":"https://api.github.com/users/chisholm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chisholm/cti-stix-validator","description":"OASIS Open Repository: Validator for STIX 2.0 JSON normative requirements and best practices","fork":true,"url":"https://api.github.com/repos/chisholm/cti-stix-validator","forks_url":"https://api.github.com/repos/chisholm/cti-stix-validator/forks","keys_url":"https://api.github.com/repos/chisholm/cti-stix-validator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chisholm/cti-stix-validator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chisholm/cti-stix-validator/teams","hooks_url":"https://api.github.com/repos/chisholm/cti-stix-validator/hooks","issue_events_url":"https://api.github.com/repos/chisholm/cti-stix-validator/issues/events{/number}","events_url":"https://api.github.com/repos/chisholm/cti-stix-validator/events","assignees_url":"https://api.github.com/repos/chisholm/cti-stix-validator/assignees{/user}","branches_url":"https://api.github.com/repos/chisholm/cti-stix-validator/branches{/branch}","tags_url":"https://api.github.com/repos/chisholm/cti-stix-validator/tags","blobs_url":"https://api.github.com/repos/chisholm/cti-stix-validator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chisholm/cti-stix-validator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chisholm/cti-stix-validator/git/refs{/sha}","trees_url":"https://api.github.com/repos/chisholm/cti-stix-validator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chisholm/cti-stix-validator/statuses/{sha}","languages_url":"https://api.github.com/repos/chisholm/cti-stix-validator/languages","stargazers_url":"https://api.github.com/repos/chisholm/cti-stix-validator/stargazers","contributors_url":"https://api.github.com/repos/chisholm/cti-stix-validator/contributors","subscribers_url":"https://api.github.com/repos/chisholm/cti-stix-validator/subscribers","subscription_url":"https://api.github.com/repos/chisholm/cti-stix-validator/subscription","commits_url":"https://api.github.com/repos/chisholm/cti-stix-validator/commits{/sha}","git_commits_url":"https://api.github.com/repos/chisholm/cti-stix-validator/git/commits{/sha}","comments_url":"https://api.github.com/repos/chisholm/cti-stix-validator/comments{/number}","issue_comment_url":"https://api.github.com/repos/chisholm/cti-stix-validator/issues/comments{/number}","contents_url":"https://api.github.com/repos/chisholm/cti-stix-validator/contents/{+path}","compare_url":"https://api.github.com/repos/chisholm/cti-stix-validator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chisholm/cti-stix-validator/merges","archive_url":"https://api.github.com/repos/chisholm/cti-stix-validator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chisholm/cti-stix-validator/downloads","issues_url":"https://api.github.com/repos/chisholm/cti-stix-validator/issues{/number}","pulls_url":"https://api.github.com/repos/chisholm/cti-stix-validator/pulls{/number}","milestones_url":"https://api.github.com/repos/chisholm/cti-stix-validator/milestones{/number}","notifications_url":"https://api.github.com/repos/chisholm/cti-stix-validator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chisholm/cti-stix-validator/labels{/name}","releases_url":"https://api.github.com/repos/chisholm/cti-stix-validator/releases{/id}","deployments_url":"https://api.github.com/repos/chisholm/cti-stix-validator/deployments","created_at":"2017-09-07T23:52:40Z","updated_at":"2017-09-07T23:52:42Z","pushed_at":"2017-09-07T23:55:01Z","git_url":"git://github.com/chisholm/cti-stix-validator.git","ssh_url":"git@github.com:chisholm/cti-stix-validator.git","clone_url":"https://github.com/chisholm/cti-stix-validator.git","svn_url":"https://github.com/chisholm/cti-stix-validator","homepage":"https://github.com/oasis-open/cti-stix-validator","size":254,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"oasis-open:master","ref":"master","sha":"510621c3e6c8ffc0dc57261b38b348505c702e55","user":{"login":"oasis-open","id":11744379,"avatar_url":"https://avatars0.githubusercontent.com/u/11744379?v=4","gravatar_id":"","url":"https://api.github.com/users/oasis-open","html_url":"https://github.com/oasis-open","followers_url":"https://api.github.com/users/oasis-open/followers","following_url":"https://api.github.com/users/oasis-open/following{/other_user}","gists_url":"https://api.github.com/users/oasis-open/gists{/gist_id}","starred_url":"https://api.github.com/users/oasis-open/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oasis-open/subscriptions","organizations_url":"https://api.github.com/users/oasis-open/orgs","repos_url":"https://api.github.com/users/oasis-open/repos","events_url":"https://api.github.com/users/oasis-open/events{/privacy}","received_events_url":"https://api.github.com/users/oasis-open/received_events","type":"Organization","site_admin":false},"repo":{"id":68161929,"name":"cti-stix-validator","full_name":"oasis-open/cti-stix-validator","owner":{"login":"oasis-open","id":11744379,"avatar_url":"https://avatars0.githubusercontent.com/u/11744379?v=4","gravatar_id":"","url":"https://api.github.com/users/oasis-open","html_url":"https://github.com/oasis-open","followers_url":"https://api.github.com/users/oasis-open/followers","following_url":"https://api.github.com/users/oasis-open/following{/other_user}","gists_url":"https://api.github.com/users/oasis-open/gists{/gist_id}","starred_url":"https://api.github.com/users/oasis-open/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oasis-open/subscriptions","organizations_url":"https://api.github.com/users/oasis-open/orgs","repos_url":"https://api.github.com/users/oasis-open/repos","events_url":"https://api.github.com/users/oasis-open/events{/privacy}","received_events_url":"https://api.github.com/users/oasis-open/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/oasis-open/cti-stix-validator","description":"OASIS Open Repository: Validator for STIX 2.0 JSON normative requirements and best practices","fork":false,"url":"https://api.github.com/repos/oasis-open/cti-stix-validator","forks_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/forks","keys_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/teams","hooks_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/hooks","issue_events_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/issues/events{/number}","events_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/events","assignees_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/assignees{/user}","branches_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/branches{/branch}","tags_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/tags","blobs_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/git/refs{/sha}","trees_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/statuses/{sha}","languages_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/languages","stargazers_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/stargazers","contributors_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/contributors","subscribers_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/subscribers","subscription_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/subscription","commits_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/commits{/sha}","git_commits_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/git/commits{/sha}","comments_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/comments{/number}","issue_comment_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/issues/comments{/number}","contents_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/contents/{+path}","compare_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/merges","archive_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/downloads","issues_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/issues{/number}","pulls_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/pulls{/number}","milestones_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/milestones{/number}","notifications_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/labels{/name}","releases_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/releases{/id}","deployments_url":"https://api.github.com/repos/oasis-open/cti-stix-validator/deployments","created_at":"2016-09-14T01:27:20Z","updated_at":"2017-08-23T02:38:39Z","pushed_at":"2017-09-08T00:01:19Z","git_url":"git://github.com/oasis-open/cti-stix-validator.git","ssh_url":"git@github.com:oasis-open/cti-stix-validator.git","clone_url":"https://github.com/oasis-open/cti-stix-validator.git","svn_url":"https://github.com/oasis-open/cti-stix-validator","homepage":"https://github.com/oasis-open/cti-stix-validator","size":254,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":4,"forks":6,"open_issues":4,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/oasis-open/cti-stix-validator/pulls/36"},"html":{"href":"https://github.com/oasis-open/cti-stix-validator/pull/36"},"issue":{"href":"https://api.github.com/repos/oasis-open/cti-stix-validator/issues/36"},"comments":{"href":"https://api.github.com/repos/oasis-open/cti-stix-validator/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/oasis-open/cti-stix-validator/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/oasis-open/cti-stix-validator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/oasis-open/cti-stix-validator/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/oasis-open/cti-stix-validator/statuses/30558d244620731facd792673787b481303641b0"}},"author_association":"NONE"}}
{"actor":{"display_login":"chisholm"}}