{"action":"created","comment":{"url":"https://api.github.com/repos/twotoasters/TWTValidation/pulls/comments/31160141","id":31160141,"diff_hunk":"@@ -43,5 +43,111 @@ - (NSSet *)validTypes\n     return nil;\n }\n \n+\n+- (NSArray *)childrenReferenceNodes\n+{\n+    NSMutableArray *referenceNodes = [[NSMutableArray alloc] init];\n+\n+    [referenceNodes addObjectsFromArray:[self childrenReferenceNodesFromNodeArray:self.andSchemas]];\n+    [referenceNodes addObjectsFromArray:[self childrenReferenceNodesFromNodeArray:self.orSchemas]];\n+    [referenceNodes addObjectsFromArray:[self childrenReferenceNodesFromNodeArray:self.exactlyOneOfSchemas]];\n+    [referenceNodes addObjectsFromArray:self.notSchema.childrenReferenceNodes];\n+\n+    [referenceNodes addObjectsFromArray:[self childrenReferenceNodesFromNodeDictionary:self.definitions]];\n+\n+    return referenceNodes;\n+}\n+\n+\n+- (NSArray *)childrenReferenceNodesFromNodeArray:(NSArray *)array\n+{\n+    if (!array) {\n+        return @[ ];\n+    }\n+\n+    NSMutableArray *referenceNodes = [[NSMutableArray alloc] init];\n+    for (TWTJSONSchemaASTNode *node in array) {\n+        [referenceNodes addObjectsFromArray:node.childrenReferenceNodes];\n+    }\n+    return [referenceNodes copy];\n+}\n+\n+\n+- (NSArray *)childrenReferenceNodesFromNodeDictionary:(NSDictionary *)dictionary\n+{\n+    if (!dictionary) {\n+        return @[ ];\n+    }\n+\n+    NSMutableArray *referenceNodes = [[NSMutableArray alloc] init];\n+    for (NSString *key in dictionary) {\n+        [referenceNodes addObjectsFromArray:[dictionary[key] childrenReferenceNodes]];\n+    }\n+    return [referenceNodes copy];\n+}\n+\n+\n+- (TWTJSONSchemaASTNode *)nodeForPathComponents:(NSArray *)path\n+{\n+    if (path.count == 0) {\n+        return self;\n+    }\n+\n+    NSString *key = path.firstObject;\n+    NSArray *remainingPath = [self remainingPathFromPath:path];\n+\n+    if ([key isEqualToString:TWTJSONSchemaKeywordAllOf]) {\n+        return [self nodeForPathComponents:remainingPath fromNodeArray:self.andSchemas];\n+    }\n+    if ([key isEqualToString:TWTJSONSchemaKeywordAnyOf]) {\n+        return [self nodeForPathComponents:remainingPath fromNodeArray:self.orSchemas];\n+    }\n+    if ([key isEqualToString:TWTJSONSchemaKeywordOneOf]) {\n+        return [self nodeForPathComponents:remainingPath fromNodeArray:self.exactlyOneOfSchemas];\n+    }\n+    if ([key isEqualToString:TWTJSONSchemaKeywordNot]) {\n+        return [self.notSchema nodeForPathComponents:remainingPath];\n+    }\n+    if ([key isEqualToString:TWTJSONSchemaKeywordDefinitions]) {\n+        return [self nodeForPathComponents:remainingPath fromDefinitions:self.definitions];\n+    }\n+\n+    return nil;\n+}\n+\n+\n+- (TWTJSONSchemaASTNode *)nodeForPathComponents:(NSArray *)path fromNodeArray:(NSArray *)array\n+{\n+    NSString *index = path.firstObject;\n+    if (!index || ![self componentIsIndex:index] || index.integerValue > array.count) {\n+        return nil;\n+    }\n+\n+    return [array[index.integerValue] nodeForPathComponents:[self remainingPathFromPath:path]];\n+}\n+\n+\n+- (TWTJSONSchemaASTNode *)nodeForPathComponents:(NSArray *)path fromDefinitions:(NSDictionary *)definitions\n+{\n+    NSString *key = path.firstObject;\n+\n+    return [definitions[key] nodeForPathComponents:[self remainingPathFromPath:path]];\n+}\n+\n+\n+- (BOOL)componentIsIndex:(NSString *)key\n+{\n+    return [key rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]].location == NSNotFound;","path":"TWTValidation/JSON Validator/AST Nodes/TWTJSONSchemaASTNode.m","position":98,"original_position":98,"commit_id":"a3fb60965480c2e02e2ed3e8c73af176dfa0a6f5","original_commit_id":"a3fb60965480c2e02e2ed3e8c73af176dfa0a6f5","user":{"login":"prachigauriar","id":4042148,"avatar_url":"https://avatars.githubusercontent.com/u/4042148?v=3","gravatar_id":"","url":"https://api.github.com/users/prachigauriar","html_url":"https://github.com/prachigauriar","followers_url":"https://api.github.com/users/prachigauriar/followers","following_url":"https://api.github.com/users/prachigauriar/following{/other_user}","gists_url":"https://api.github.com/users/prachigauriar/gists{/gist_id}","starred_url":"https://api.github.com/users/prachigauriar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prachigauriar/subscriptions","organizations_url":"https://api.github.com/users/prachigauriar/orgs","repos_url":"https://api.github.com/users/prachigauriar/repos","events_url":"https://api.github.com/users/prachigauriar/events{/privacy}","received_events_url":"https://api.github.com/users/prachigauriar/received_events","type":"User","site_admin":false},"body":"I’m generally not a fan of using dot-syntax after a message send. Do you mind putting this in a temporary variable?","created_at":"2015-05-27T17:44:24Z","updated_at":"2015-05-27T17:44:24Z","html_url":"https://github.com/twotoasters/TWTValidation/pull/34#discussion_r31160141","pull_request_url":"https://api.github.com/repos/twotoasters/TWTValidation/pulls/34","_links":{"self":{"href":"https://api.github.com/repos/twotoasters/TWTValidation/pulls/comments/31160141"},"html":{"href":"https://github.com/twotoasters/TWTValidation/pull/34#discussion_r31160141"},"pull_request":{"href":"https://api.github.com/repos/twotoasters/TWTValidation/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/twotoasters/TWTValidation/pulls/34","id":30800436,"html_url":"https://github.com/twotoasters/TWTValidation/pull/34","diff_url":"https://github.com/twotoasters/TWTValidation/pull/34.diff","patch_url":"https://github.com/twotoasters/TWTValidation/pull/34.patch","issue_url":"https://api.github.com/repos/twotoasters/TWTValidation/issues/34","number":34,"state":"open","locked":false,"title":"Validate references internal to schema","user":{"login":"jillhc","id":7916504,"avatar_url":"https://avatars.githubusercontent.com/u/7916504?v=3","gravatar_id":"","url":"https://api.github.com/users/jillhc","html_url":"https://github.com/jillhc","followers_url":"https://api.github.com/users/jillhc/followers","following_url":"https://api.github.com/users/jillhc/following{/other_user}","gists_url":"https://api.github.com/users/jillhc/gists{/gist_id}","starred_url":"https://api.github.com/users/jillhc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jillhc/subscriptions","organizations_url":"https://api.github.com/users/jillhc/orgs","repos_url":"https://api.github.com/users/jillhc/repos","events_url":"https://api.github.com/users/jillhc/events{/privacy}","received_events_url":"https://api.github.com/users/jillhc/received_events","type":"User","site_admin":false},"body":"Supports the basic case. Still to do:\r\n* Remote references\r\n* escaped pointers","created_at":"2015-03-09T21:11:08Z","updated_at":"2015-05-27T17:44:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5b25313c7c9b538cdc790680b33c8b769633b898","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/twotoasters/TWTValidation/pulls/34/commits","review_comments_url":"https://api.github.com/repos/twotoasters/TWTValidation/pulls/34/comments","review_comment_url":"https://api.github.com/repos/twotoasters/TWTValidation/pulls/comments{/number}","comments_url":"https://api.github.com/repos/twotoasters/TWTValidation/issues/34/comments","statuses_url":"https://api.github.com/repos/twotoasters/TWTValidation/statuses/a3fb60965480c2e02e2ed3e8c73af176dfa0a6f5","head":{"label":"twotoasters:definitions","ref":"definitions","sha":"a3fb60965480c2e02e2ed3e8c73af176dfa0a6f5","user":{"login":"twotoasters","id":112994,"avatar_url":"https://avatars.githubusercontent.com/u/112994?v=3","gravatar_id":"","url":"https://api.github.com/users/twotoasters","html_url":"https://github.com/twotoasters","followers_url":"https://api.github.com/users/twotoasters/followers","following_url":"https://api.github.com/users/twotoasters/following{/other_user}","gists_url":"https://api.github.com/users/twotoasters/gists{/gist_id}","starred_url":"https://api.github.com/users/twotoasters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twotoasters/subscriptions","organizations_url":"https://api.github.com/users/twotoasters/orgs","repos_url":"https://api.github.com/users/twotoasters/repos","events_url":"https://api.github.com/users/twotoasters/events{/privacy}","received_events_url":"https://api.github.com/users/twotoasters/received_events","type":"Organization","site_admin":false},"repo":{"id":18248731,"name":"TWTValidation","full_name":"twotoasters/TWTValidation","owner":{"login":"twotoasters","id":112994,"avatar_url":"https://avatars.githubusercontent.com/u/112994?v=3","gravatar_id":"","url":"https://api.github.com/users/twotoasters","html_url":"https://github.com/twotoasters","followers_url":"https://api.github.com/users/twotoasters/followers","following_url":"https://api.github.com/users/twotoasters/following{/other_user}","gists_url":"https://api.github.com/users/twotoasters/gists{/gist_id}","starred_url":"https://api.github.com/users/twotoasters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twotoasters/subscriptions","organizations_url":"https://api.github.com/users/twotoasters/orgs","repos_url":"https://api.github.com/users/twotoasters/repos","events_url":"https://api.github.com/users/twotoasters/events{/privacy}","received_events_url":"https://api.github.com/users/twotoasters/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/twotoasters/TWTValidation","description":"TWTValidation is a Cocoa framework for declaratively validating data.","fork":false,"url":"https://api.github.com/repos/twotoasters/TWTValidation","forks_url":"https://api.github.com/repos/twotoasters/TWTValidation/forks","keys_url":"https://api.github.com/repos/twotoasters/TWTValidation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twotoasters/TWTValidation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twotoasters/TWTValidation/teams","hooks_url":"https://api.github.com/repos/twotoasters/TWTValidation/hooks","issue_events_url":"https://api.github.com/repos/twotoasters/TWTValidation/issues/events{/number}","events_url":"https://api.github.com/repos/twotoasters/TWTValidation/events","assignees_url":"https://api.github.com/repos/twotoasters/TWTValidation/assignees{/user}","branches_url":"https://api.github.com/repos/twotoasters/TWTValidation/branches{/branch}","tags_url":"https://api.github.com/repos/twotoasters/TWTValidation/tags","blobs_url":"https://api.github.com/repos/twotoasters/TWTValidation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twotoasters/TWTValidation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twotoasters/TWTValidation/git/refs{/sha}","trees_url":"https://api.github.com/repos/twotoasters/TWTValidation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twotoasters/TWTValidation/statuses/{sha}","languages_url":"https://api.github.com/repos/twotoasters/TWTValidation/languages","stargazers_url":"https://api.github.com/repos/twotoasters/TWTValidation/stargazers","contributors_url":"https://api.github.com/repos/twotoasters/TWTValidation/contributors","subscribers_url":"https://api.github.com/repos/twotoasters/TWTValidation/subscribers","subscription_url":"https://api.github.com/repos/twotoasters/TWTValidation/subscription","commits_url":"https://api.github.com/repos/twotoasters/TWTValidation/commits{/sha}","git_commits_url":"https://api.github.com/repos/twotoasters/TWTValidation/git/commits{/sha}","comments_url":"https://api.github.com/repos/twotoasters/TWTValidation/comments{/number}","issue_comment_url":"https://api.github.com/repos/twotoasters/TWTValidation/issues/comments{/number}","contents_url":"https://api.github.com/repos/twotoasters/TWTValidation/contents/{+path}","compare_url":"https://api.github.com/repos/twotoasters/TWTValidation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twotoasters/TWTValidation/merges","archive_url":"https://api.github.com/repos/twotoasters/TWTValidation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twotoasters/TWTValidation/downloads","issues_url":"https://api.github.com/repos/twotoasters/TWTValidation/issues{/number}","pulls_url":"https://api.github.com/repos/twotoasters/TWTValidation/pulls{/number}","milestones_url":"https://api.github.com/repos/twotoasters/TWTValidation/milestones{/number}","notifications_url":"https://api.github.com/repos/twotoasters/TWTValidation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twotoasters/TWTValidation/labels{/name}","releases_url":"https://api.github.com/repos/twotoasters/TWTValidation/releases{/id}","created_at":"2014-03-29T19:19:21Z","updated_at":"2015-04-03T20:33:26Z","pushed_at":"2015-05-12T16:34:11Z","git_url":"git://github.com/twotoasters/TWTValidation.git","ssh_url":"git@github.com:twotoasters/TWTValidation.git","clone_url":"https://github.com/twotoasters/TWTValidation.git","svn_url":"https://github.com/twotoasters/TWTValidation","homepage":"","size":1282,"stargazers_count":19,"watchers_count":19,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":19,"default_branch":"master"}},"base":{"label":"twotoasters:documentation","ref":"documentation","sha":"c2e94176d36b59ff741211bc8dc3a9b2d14a87b2","user":{"login":"twotoasters","id":112994,"avatar_url":"https://avatars.githubusercontent.com/u/112994?v=3","gravatar_id":"","url":"https://api.github.com/users/twotoasters","html_url":"https://github.com/twotoasters","followers_url":"https://api.github.com/users/twotoasters/followers","following_url":"https://api.github.com/users/twotoasters/following{/other_user}","gists_url":"https://api.github.com/users/twotoasters/gists{/gist_id}","starred_url":"https://api.github.com/users/twotoasters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twotoasters/subscriptions","organizations_url":"https://api.github.com/users/twotoasters/orgs","repos_url":"https://api.github.com/users/twotoasters/repos","events_url":"https://api.github.com/users/twotoasters/events{/privacy}","received_events_url":"https://api.github.com/users/twotoasters/received_events","type":"Organization","site_admin":false},"repo":{"id":18248731,"name":"TWTValidation","full_name":"twotoasters/TWTValidation","owner":{"login":"twotoasters","id":112994,"avatar_url":"https://avatars.githubusercontent.com/u/112994?v=3","gravatar_id":"","url":"https://api.github.com/users/twotoasters","html_url":"https://github.com/twotoasters","followers_url":"https://api.github.com/users/twotoasters/followers","following_url":"https://api.github.com/users/twotoasters/following{/other_user}","gists_url":"https://api.github.com/users/twotoasters/gists{/gist_id}","starred_url":"https://api.github.com/users/twotoasters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twotoasters/subscriptions","organizations_url":"https://api.github.com/users/twotoasters/orgs","repos_url":"https://api.github.com/users/twotoasters/repos","events_url":"https://api.github.com/users/twotoasters/events{/privacy}","received_events_url":"https://api.github.com/users/twotoasters/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/twotoasters/TWTValidation","description":"TWTValidation is a Cocoa framework for declaratively validating data.","fork":false,"url":"https://api.github.com/repos/twotoasters/TWTValidation","forks_url":"https://api.github.com/repos/twotoasters/TWTValidation/forks","keys_url":"https://api.github.com/repos/twotoasters/TWTValidation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twotoasters/TWTValidation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twotoasters/TWTValidation/teams","hooks_url":"https://api.github.com/repos/twotoasters/TWTValidation/hooks","issue_events_url":"https://api.github.com/repos/twotoasters/TWTValidation/issues/events{/number}","events_url":"https://api.github.com/repos/twotoasters/TWTValidation/events","assignees_url":"https://api.github.com/repos/twotoasters/TWTValidation/assignees{/user}","branches_url":"https://api.github.com/repos/twotoasters/TWTValidation/branches{/branch}","tags_url":"https://api.github.com/repos/twotoasters/TWTValidation/tags","blobs_url":"https://api.github.com/repos/twotoasters/TWTValidation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twotoasters/TWTValidation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twotoasters/TWTValidation/git/refs{/sha}","trees_url":"https://api.github.com/repos/twotoasters/TWTValidation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twotoasters/TWTValidation/statuses/{sha}","languages_url":"https://api.github.com/repos/twotoasters/TWTValidation/languages","stargazers_url":"https://api.github.com/repos/twotoasters/TWTValidation/stargazers","contributors_url":"https://api.github.com/repos/twotoasters/TWTValidation/contributors","subscribers_url":"https://api.github.com/repos/twotoasters/TWTValidation/subscribers","subscription_url":"https://api.github.com/repos/twotoasters/TWTValidation/subscription","commits_url":"https://api.github.com/repos/twotoasters/TWTValidation/commits{/sha}","git_commits_url":"https://api.github.com/repos/twotoasters/TWTValidation/git/commits{/sha}","comments_url":"https://api.github.com/repos/twotoasters/TWTValidation/comments{/number}","issue_comment_url":"https://api.github.com/repos/twotoasters/TWTValidation/issues/comments{/number}","contents_url":"https://api.github.com/repos/twotoasters/TWTValidation/contents/{+path}","compare_url":"https://api.github.com/repos/twotoasters/TWTValidation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twotoasters/TWTValidation/merges","archive_url":"https://api.github.com/repos/twotoasters/TWTValidation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twotoasters/TWTValidation/downloads","issues_url":"https://api.github.com/repos/twotoasters/TWTValidation/issues{/number}","pulls_url":"https://api.github.com/repos/twotoasters/TWTValidation/pulls{/number}","milestones_url":"https://api.github.com/repos/twotoasters/TWTValidation/milestones{/number}","notifications_url":"https://api.github.com/repos/twotoasters/TWTValidation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twotoasters/TWTValidation/labels{/name}","releases_url":"https://api.github.com/repos/twotoasters/TWTValidation/releases{/id}","created_at":"2014-03-29T19:19:21Z","updated_at":"2015-04-03T20:33:26Z","pushed_at":"2015-05-12T16:34:11Z","git_url":"git://github.com/twotoasters/TWTValidation.git","ssh_url":"git@github.com:twotoasters/TWTValidation.git","clone_url":"https://github.com/twotoasters/TWTValidation.git","svn_url":"https://github.com/twotoasters/TWTValidation","homepage":"","size":1282,"stargazers_count":19,"watchers_count":19,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":19,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/twotoasters/TWTValidation/pulls/34"},"html":{"href":"https://github.com/twotoasters/TWTValidation/pull/34"},"issue":{"href":"https://api.github.com/repos/twotoasters/TWTValidation/issues/34"},"comments":{"href":"https://api.github.com/repos/twotoasters/TWTValidation/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/twotoasters/TWTValidation/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/twotoasters/TWTValidation/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/twotoasters/TWTValidation/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/twotoasters/TWTValidation/statuses/a3fb60965480c2e02e2ed3e8c73af176dfa0a6f5"}}}}