{"action":"created","comment":{"url":"https://api.github.com/repos/socrata-platform/computation-strategies/pulls/comments/63909744","id":63909744,"diff_hunk":"@@ -42,23 +54,33 @@ trait ComputationStrategy {\n \n   def targetColumnType: SoQLType\n \n-  def validate[ColumnName : JsonDecode](definition: StrategyDefinition[ColumnName]): Option[ValidationError]\n+  def validate[ColumnName : JsonDecode](definition: StrategyDefinition[ColumnName]): Option[ValidationError] =\n+    validate[ColumnName](definition, None)\n+\n+  def validate[ColumnName : JsonDecode](definition: StrategyDefinition[ColumnName],\n+                                        columns: Map[ColumnName, SoQLType]): Option[ValidationError] =\n+    validate[ColumnName](definition, Some(columns))\n+\n+  protected def validate[ColumnName : JsonDecode](definition: StrategyDefinition[ColumnName],\n+                                                  columns: Option[Map[ColumnName, SoQLType]]): Option[ValidationError]\n }\n \n object ComputationStrategy {\n \n-  def validate[ColumnName : JsonDecode](definition: StrategyDefinition[ColumnName]): Option[ValidationError] = definition.typ match {\n-    case StrategyType.GeoRegionMatchOnPoint =>\n-      GeoRegionMatchOnPointComputationStrategy.validate[ColumnName](definition)\n-    case StrategyType.GeoRegion =>\n-      GeoRegionMatchOnPointComputationStrategy.validate[ColumnName](definition)\n-    case StrategyType.GeoRegionMatchOnString =>\n-      GeoRegionMatchOnStringComputationStrategy.validate[ColumnName](definition)\n-    case StrategyType.Geocoding =>\n-      GeocodingComputationStrategy.validate[ColumnName](definition)\n-    case StrategyType.Test =>\n-      TestComputationStrategy.validate[ColumnName](definition)\n-  }\n+  val strategies = Map[StrategyType.Value, ComputationStrategy](\n+    StrategyType.GeoRegionMatchOnPoint -> GeoRegionMatchOnPointComputationStrategy,\n+    StrategyType.GeoRegion -> GeoRegionMatchOnPointComputationStrategy,\n+    StrategyType.GeoRegionMatchOnString -> GeoRegionMatchOnStringComputationStrategy,\n+    StrategyType.Geocoding -> GeocodingComputationStrategy,\n+    StrategyType.Test -> TestComputationStrategy\n+  )\n+\n+  def validate[ColumnName : JsonDecode](definition: StrategyDefinition[ColumnName]): Option[ValidationError] =\n+    strategies(definition.typ).validate[ColumnName](definition)","path":"src/main/scala/com/socrata/computation_strategies/ComputationStrategy.scala","position":73,"original_position":77,"commit_id":"c79b2d58618b71f751355da78f180dab3faf89bf","original_commit_id":"c79b2d58618b71f751355da78f180dab3faf89bf","user":{"login":"rjmac","id":753700,"avatar_url":"https://avatars.githubusercontent.com/u/753700?v=3","gravatar_id":"","url":"https://api.github.com/users/rjmac","html_url":"https://github.com/rjmac","followers_url":"https://api.github.com/users/rjmac/followers","following_url":"https://api.github.com/users/rjmac/following{/other_user}","gists_url":"https://api.github.com/users/rjmac/gists{/gist_id}","starred_url":"https://api.github.com/users/rjmac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjmac/subscriptions","organizations_url":"https://api.github.com/users/rjmac/orgs","repos_url":"https://api.github.com/users/rjmac/repos","events_url":"https://api.github.com/users/rjmac/events{/privacy}","received_events_url":"https://api.github.com/users/rjmac/received_events","type":"User","site_admin":false},"body":"...or when the inferred type parameter would be too specific, which happens but relatively rarely.","created_at":"2016-05-19T16:21:01Z","updated_at":"2016-05-19T16:21:01Z","html_url":"https://github.com/socrata-platform/computation-strategies/pull/1#discussion_r63909744","pull_request_url":"https://api.github.com/repos/socrata-platform/computation-strategies/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/socrata-platform/computation-strategies/pulls/comments/63909744"},"html":{"href":"https://github.com/socrata-platform/computation-strategies/pull/1#discussion_r63909744"},"pull_request":{"href":"https://api.github.com/repos/socrata-platform/computation-strategies/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/socrata-platform/computation-strategies/pulls/1","id":70585156,"html_url":"https://github.com/socrata-platform/computation-strategies/pull/1","diff_url":"https://github.com/socrata-platform/computation-strategies/pull/1.diff","patch_url":"https://github.com/socrata-platform/computation-strategies/pull/1.patch","issue_url":"https://api.github.com/repos/socrata-platform/computation-strategies/issues/1","number":1,"state":"open","locked":false,"title":"Refactor computation validation","user":{"login":"aerust","id":7904661,"avatar_url":"https://avatars.githubusercontent.com/u/7904661?v=3","gravatar_id":"","url":"https://api.github.com/users/aerust","html_url":"https://github.com/aerust","followers_url":"https://api.github.com/users/aerust/followers","following_url":"https://api.github.com/users/aerust/following{/other_user}","gists_url":"https://api.github.com/users/aerust/gists{/gist_id}","starred_url":"https://api.github.com/users/aerust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aerust/subscriptions","organizations_url":"https://api.github.com/users/aerust/orgs","repos_url":"https://api.github.com/users/aerust/repos","events_url":"https://api.github.com/users/aerust/events{/privacy}","received_events_url":"https://api.github.com/users/aerust/received_events","type":"User","site_admin":false},"body":"Implements validation for \"test\" computation strategy","created_at":"2016-05-18T19:27:42Z","updated_at":"2016-05-19T16:21:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e8492ca9f5b5321f81d3223fbfa93ba855913869","assignee":{"login":"rjmac","id":753700,"avatar_url":"https://avatars.githubusercontent.com/u/753700?v=3","gravatar_id":"","url":"https://api.github.com/users/rjmac","html_url":"https://github.com/rjmac","followers_url":"https://api.github.com/users/rjmac/followers","following_url":"https://api.github.com/users/rjmac/following{/other_user}","gists_url":"https://api.github.com/users/rjmac/gists{/gist_id}","starred_url":"https://api.github.com/users/rjmac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjmac/subscriptions","organizations_url":"https://api.github.com/users/rjmac/orgs","repos_url":"https://api.github.com/users/rjmac/repos","events_url":"https://api.github.com/users/rjmac/events{/privacy}","received_events_url":"https://api.github.com/users/rjmac/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/socrata-platform/computation-strategies/pulls/1/commits","review_comments_url":"https://api.github.com/repos/socrata-platform/computation-strategies/pulls/1/comments","review_comment_url":"https://api.github.com/repos/socrata-platform/computation-strategies/pulls/comments{/number}","comments_url":"https://api.github.com/repos/socrata-platform/computation-strategies/issues/1/comments","statuses_url":"https://api.github.com/repos/socrata-platform/computation-strategies/statuses/c79b2d58618b71f751355da78f180dab3faf89bf","head":{"label":"socrata-platform:aerust/refactor","ref":"aerust/refactor","sha":"c79b2d58618b71f751355da78f180dab3faf89bf","user":{"login":"socrata-platform","id":12076358,"avatar_url":"https://avatars.githubusercontent.com/u/12076358?v=3","gravatar_id":"","url":"https://api.github.com/users/socrata-platform","html_url":"https://github.com/socrata-platform","followers_url":"https://api.github.com/users/socrata-platform/followers","following_url":"https://api.github.com/users/socrata-platform/following{/other_user}","gists_url":"https://api.github.com/users/socrata-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/socrata-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socrata-platform/subscriptions","organizations_url":"https://api.github.com/users/socrata-platform/orgs","repos_url":"https://api.github.com/users/socrata-platform/repos","events_url":"https://api.github.com/users/socrata-platform/events{/privacy}","received_events_url":"https://api.github.com/users/socrata-platform/received_events","type":"Organization","site_admin":false},"repo":{"id":58416039,"name":"computation-strategies","full_name":"socrata-platform/computation-strategies","owner":{"login":"socrata-platform","id":12076358,"avatar_url":"https://avatars.githubusercontent.com/u/12076358?v=3","gravatar_id":"","url":"https://api.github.com/users/socrata-platform","html_url":"https://github.com/socrata-platform","followers_url":"https://api.github.com/users/socrata-platform/followers","following_url":"https://api.github.com/users/socrata-platform/following{/other_user}","gists_url":"https://api.github.com/users/socrata-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/socrata-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socrata-platform/subscriptions","organizations_url":"https://api.github.com/users/socrata-platform/orgs","repos_url":"https://api.github.com/users/socrata-platform/repos","events_url":"https://api.github.com/users/socrata-platform/events{/privacy}","received_events_url":"https://api.github.com/users/socrata-platform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/socrata-platform/computation-strategies","description":"Computation strategy definitions","fork":false,"url":"https://api.github.com/repos/socrata-platform/computation-strategies","forks_url":"https://api.github.com/repos/socrata-platform/computation-strategies/forks","keys_url":"https://api.github.com/repos/socrata-platform/computation-strategies/keys{/key_id}","collaborators_url":"https://api.github.com/repos/socrata-platform/computation-strategies/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/socrata-platform/computation-strategies/teams","hooks_url":"https://api.github.com/repos/socrata-platform/computation-strategies/hooks","issue_events_url":"https://api.github.com/repos/socrata-platform/computation-strategies/issues/events{/number}","events_url":"https://api.github.com/repos/socrata-platform/computation-strategies/events","assignees_url":"https://api.github.com/repos/socrata-platform/computation-strategies/assignees{/user}","branches_url":"https://api.github.com/repos/socrata-platform/computation-strategies/branches{/branch}","tags_url":"https://api.github.com/repos/socrata-platform/computation-strategies/tags","blobs_url":"https://api.github.com/repos/socrata-platform/computation-strategies/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/socrata-platform/computation-strategies/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/socrata-platform/computation-strategies/git/refs{/sha}","trees_url":"https://api.github.com/repos/socrata-platform/computation-strategies/git/trees{/sha}","statuses_url":"https://api.github.com/repos/socrata-platform/computation-strategies/statuses/{sha}","languages_url":"https://api.github.com/repos/socrata-platform/computation-strategies/languages","stargazers_url":"https://api.github.com/repos/socrata-platform/computation-strategies/stargazers","contributors_url":"https://api.github.com/repos/socrata-platform/computation-strategies/contributors","subscribers_url":"https://api.github.com/repos/socrata-platform/computation-strategies/subscribers","subscription_url":"https://api.github.com/repos/socrata-platform/computation-strategies/subscription","commits_url":"https://api.github.com/repos/socrata-platform/computation-strategies/commits{/sha}","git_commits_url":"https://api.github.com/repos/socrata-platform/computation-strategies/git/commits{/sha}","comments_url":"https://api.github.com/repos/socrata-platform/computation-strategies/comments{/number}","issue_comment_url":"https://api.github.com/repos/socrata-platform/computation-strategies/issues/comments{/number}","contents_url":"https://api.github.com/repos/socrata-platform/computation-strategies/contents/{+path}","compare_url":"https://api.github.com/repos/socrata-platform/computation-strategies/compare/{base}...{head}","merges_url":"https://api.github.com/repos/socrata-platform/computation-strategies/merges","archive_url":"https://api.github.com/repos/socrata-platform/computation-strategies/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/socrata-platform/computation-strategies/downloads","issues_url":"https://api.github.com/repos/socrata-platform/computation-strategies/issues{/number}","pulls_url":"https://api.github.com/repos/socrata-platform/computation-strategies/pulls{/number}","milestones_url":"https://api.github.com/repos/socrata-platform/computation-strategies/milestones{/number}","notifications_url":"https://api.github.com/repos/socrata-platform/computation-strategies/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/socrata-platform/computation-strategies/labels{/name}","releases_url":"https://api.github.com/repos/socrata-platform/computation-strategies/releases{/id}","deployments_url":"https://api.github.com/repos/socrata-platform/computation-strategies/deployments","created_at":"2016-05-09T23:59:27Z","updated_at":"2016-05-17T17:34:35Z","pushed_at":"2016-05-19T16:15:36Z","git_url":"git://github.com/socrata-platform/computation-strategies.git","ssh_url":"git@github.com:socrata-platform/computation-strategies.git","clone_url":"https://github.com/socrata-platform/computation-strategies.git","svn_url":"https://github.com/socrata-platform/computation-strategies","homepage":null,"size":24,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"socrata-platform:master","ref":"master","sha":"e1aa4f7562005eddcc90402a0ebdb1b3c34b7798","user":{"login":"socrata-platform","id":12076358,"avatar_url":"https://avatars.githubusercontent.com/u/12076358?v=3","gravatar_id":"","url":"https://api.github.com/users/socrata-platform","html_url":"https://github.com/socrata-platform","followers_url":"https://api.github.com/users/socrata-platform/followers","following_url":"https://api.github.com/users/socrata-platform/following{/other_user}","gists_url":"https://api.github.com/users/socrata-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/socrata-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socrata-platform/subscriptions","organizations_url":"https://api.github.com/users/socrata-platform/orgs","repos_url":"https://api.github.com/users/socrata-platform/repos","events_url":"https://api.github.com/users/socrata-platform/events{/privacy}","received_events_url":"https://api.github.com/users/socrata-platform/received_events","type":"Organization","site_admin":false},"repo":{"id":58416039,"name":"computation-strategies","full_name":"socrata-platform/computation-strategies","owner":{"login":"socrata-platform","id":12076358,"avatar_url":"https://avatars.githubusercontent.com/u/12076358?v=3","gravatar_id":"","url":"https://api.github.com/users/socrata-platform","html_url":"https://github.com/socrata-platform","followers_url":"https://api.github.com/users/socrata-platform/followers","following_url":"https://api.github.com/users/socrata-platform/following{/other_user}","gists_url":"https://api.github.com/users/socrata-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/socrata-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socrata-platform/subscriptions","organizations_url":"https://api.github.com/users/socrata-platform/orgs","repos_url":"https://api.github.com/users/socrata-platform/repos","events_url":"https://api.github.com/users/socrata-platform/events{/privacy}","received_events_url":"https://api.github.com/users/socrata-platform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/socrata-platform/computation-strategies","description":"Computation strategy definitions","fork":false,"url":"https://api.github.com/repos/socrata-platform/computation-strategies","forks_url":"https://api.github.com/repos/socrata-platform/computation-strategies/forks","keys_url":"https://api.github.com/repos/socrata-platform/computation-strategies/keys{/key_id}","collaborators_url":"https://api.github.com/repos/socrata-platform/computation-strategies/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/socrata-platform/computation-strategies/teams","hooks_url":"https://api.github.com/repos/socrata-platform/computation-strategies/hooks","issue_events_url":"https://api.github.com/repos/socrata-platform/computation-strategies/issues/events{/number}","events_url":"https://api.github.com/repos/socrata-platform/computation-strategies/events","assignees_url":"https://api.github.com/repos/socrata-platform/computation-strategies/assignees{/user}","branches_url":"https://api.github.com/repos/socrata-platform/computation-strategies/branches{/branch}","tags_url":"https://api.github.com/repos/socrata-platform/computation-strategies/tags","blobs_url":"https://api.github.com/repos/socrata-platform/computation-strategies/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/socrata-platform/computation-strategies/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/socrata-platform/computation-strategies/git/refs{/sha}","trees_url":"https://api.github.com/repos/socrata-platform/computation-strategies/git/trees{/sha}","statuses_url":"https://api.github.com/repos/socrata-platform/computation-strategies/statuses/{sha}","languages_url":"https://api.github.com/repos/socrata-platform/computation-strategies/languages","stargazers_url":"https://api.github.com/repos/socrata-platform/computation-strategies/stargazers","contributors_url":"https://api.github.com/repos/socrata-platform/computation-strategies/contributors","subscribers_url":"https://api.github.com/repos/socrata-platform/computation-strategies/subscribers","subscription_url":"https://api.github.com/repos/socrata-platform/computation-strategies/subscription","commits_url":"https://api.github.com/repos/socrata-platform/computation-strategies/commits{/sha}","git_commits_url":"https://api.github.com/repos/socrata-platform/computation-strategies/git/commits{/sha}","comments_url":"https://api.github.com/repos/socrata-platform/computation-strategies/comments{/number}","issue_comment_url":"https://api.github.com/repos/socrata-platform/computation-strategies/issues/comments{/number}","contents_url":"https://api.github.com/repos/socrata-platform/computation-strategies/contents/{+path}","compare_url":"https://api.github.com/repos/socrata-platform/computation-strategies/compare/{base}...{head}","merges_url":"https://api.github.com/repos/socrata-platform/computation-strategies/merges","archive_url":"https://api.github.com/repos/socrata-platform/computation-strategies/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/socrata-platform/computation-strategies/downloads","issues_url":"https://api.github.com/repos/socrata-platform/computation-strategies/issues{/number}","pulls_url":"https://api.github.com/repos/socrata-platform/computation-strategies/pulls{/number}","milestones_url":"https://api.github.com/repos/socrata-platform/computation-strategies/milestones{/number}","notifications_url":"https://api.github.com/repos/socrata-platform/computation-strategies/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/socrata-platform/computation-strategies/labels{/name}","releases_url":"https://api.github.com/repos/socrata-platform/computation-strategies/releases{/id}","deployments_url":"https://api.github.com/repos/socrata-platform/computation-strategies/deployments","created_at":"2016-05-09T23:59:27Z","updated_at":"2016-05-17T17:34:35Z","pushed_at":"2016-05-19T16:15:36Z","git_url":"git://github.com/socrata-platform/computation-strategies.git","ssh_url":"git@github.com:socrata-platform/computation-strategies.git","clone_url":"https://github.com/socrata-platform/computation-strategies.git","svn_url":"https://github.com/socrata-platform/computation-strategies","homepage":null,"size":24,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/socrata-platform/computation-strategies/pulls/1"},"html":{"href":"https://github.com/socrata-platform/computation-strategies/pull/1"},"issue":{"href":"https://api.github.com/repos/socrata-platform/computation-strategies/issues/1"},"comments":{"href":"https://api.github.com/repos/socrata-platform/computation-strategies/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/socrata-platform/computation-strategies/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/socrata-platform/computation-strategies/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/socrata-platform/computation-strategies/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/socrata-platform/computation-strategies/statuses/c79b2d58618b71f751355da78f180dab3faf89bf"}}}}