{"action":"created","comment":{"url":"https://api.github.com/repos/CommBank/coppersmith/pulls/comments/70205696","id":70205696,"diff_hunk":"@@ -15,26 +15,40 @@\n package commbank.coppersmith.tools\n \n import commbank.coppersmith.{MetadataOutput, MetadataSet}\n-import commbank.coppersmith.Feature.Conforms, Conforms.conforms_?\n+import commbank.coppersmith.Feature.{Value, Type, Conforms}, Conforms.conforms_?\n import commbank.coppersmith.tools.util.ObjectFinder\n \n object MetadataMain {\n+  sealed trait FormatType\n+  case object PsvFormat extends FormatType\n+  case object JsonFormat extends FormatType\n+\n   def main(args:Array[String]) = {\n     val (format, packagge) = args.take(2) match {\n-      case Array(\"--psv\", pkg)  => ( MetadataOutput.Psv, pkg)\n-      case Array(\"--json\", pkg) => ( MetadataOutput.JsonObject, pkg)\n-      case Array(pkg)           => ( MetadataOutput.JsonObject, pkg)\n+      case Array(\"--psv\", pkg)  => ( PsvFormat, pkg)\n+      case Array(\"--json\", pkg) => (JsonFormat, pkg)\n+      case Array(pkg)           => (JsonFormat, pkg)\n       case _                    => println(\"Invalid input\"); sys.exit(1)\n     }\n \n-    val metadataSets = ObjectFinder.findObjects[MetadataSet[_]](packagge, \"commbank.coppersmith\")\n+    val metadataSets = ObjectFinder.findObjects[MetadataSet[Any]](packagge, \"commbank.coppersmith\").toList\n+\n     val allConforms =\n-      ObjectFinder.findObjects[Conforms[_, _]](args(0), \"commbank.coppersmith\", \"au.com.cba.omnia\")\n+      ObjectFinder.findObjects[Conforms[Type, Value]](args(0), \"commbank.coppersmith\", \"au.com.cba.omnia\")\n+\n+    // The repetition here is regrettable but getting the types without statically\n+    //knowing the formatter is really awkward\n \n-    metadataSets.foreach { ms =>\n-      val metadataConformsSet = ms.metadata.map(m => (m, allConforms.find(c => conforms_?(c, m)))).toList\n-      val outputString = MetadataOutput.metadataString(metadataConformsSet, format)\n-      println(outputString)\n+    val output: String = format match {\n+      case PsvFormat =>\n+        MetadataOutput.Psv.stringify(MetadataOutput.Psv.doOutput(metadataSets, allConforms))\n+      case JsonFormat =>\n+        if (!metadataSets.isEmpty) {\n+          MetadataOutput.Json0.stringify(MetadataOutput.Json0.doOutput(metadataSets, allConforms))","path":"tools/src/main/scala/commbank/coppersmith/tools/MetadataMain.scala","position":43,"original_position":43,"commit_id":"862ceeebe0abe1fbb8931bef2dff68c3367ae4b4","original_commit_id":"862ceeebe0abe1fbb8931bef2dff68c3367ae4b4","user":{"login":"dkristian","id":551256,"avatar_url":"https://avatars.githubusercontent.com/u/551256?v=3","gravatar_id":"","url":"https://api.github.com/users/dkristian","html_url":"https://github.com/dkristian","followers_url":"https://api.github.com/users/dkristian/followers","following_url":"https://api.github.com/users/dkristian/following{/other_user}","gists_url":"https://api.github.com/users/dkristian/gists{/gist_id}","starred_url":"https://api.github.com/users/dkristian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkristian/subscriptions","organizations_url":"https://api.github.com/users/dkristian/orgs","repos_url":"https://api.github.com/users/dkristian/repos","events_url":"https://api.github.com/users/dkristian/events{/privacy}","received_events_url":"https://api.github.com/users/dkristian/received_events","type":"User","site_admin":false},"body":"Does this mean that only version `0` json is output? Should we have an additional `version` arg (or two args; `json0` and `json1`) to output version `1` accordingly?","created_at":"2016-07-11T06:07:21Z","updated_at":"2016-07-11T06:07:21Z","html_url":"https://github.com/CommBank/coppersmith/pull/40#discussion_r70205696","pull_request_url":"https://api.github.com/repos/CommBank/coppersmith/pulls/40","_links":{"self":{"href":"https://api.github.com/repos/CommBank/coppersmith/pulls/comments/70205696"},"html":{"href":"https://github.com/CommBank/coppersmith/pull/40#discussion_r70205696"},"pull_request":{"href":"https://api.github.com/repos/CommBank/coppersmith/pulls/40"}}},"pull_request":{"url":"https://api.github.com/repos/CommBank/coppersmith/pulls/40","id":76889889,"html_url":"https://github.com/CommBank/coppersmith/pull/40","diff_url":"https://github.com/CommBank/coppersmith/pull/40.diff","patch_url":"https://github.com/CommBank/coppersmith/pull/40.patch","issue_url":"https://api.github.com/repos/CommBank/coppersmith/issues/40","number":40,"state":"open","locked":false,"title":"Json spec","user":{"login":"triggerNZ","id":489039,"avatar_url":"https://avatars.githubusercontent.com/u/489039?v=3","gravatar_id":"","url":"https://api.github.com/users/triggerNZ","html_url":"https://github.com/triggerNZ","followers_url":"https://api.github.com/users/triggerNZ/followers","following_url":"https://api.github.com/users/triggerNZ/following{/other_user}","gists_url":"https://api.github.com/users/triggerNZ/gists{/gist_id}","starred_url":"https://api.github.com/users/triggerNZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/triggerNZ/subscriptions","organizations_url":"https://api.github.com/users/triggerNZ/orgs","repos_url":"https://api.github.com/users/triggerNZ/repos","events_url":"https://api.github.com/users/triggerNZ/events{/privacy}","received_events_url":"https://api.github.com/users/triggerNZ/received_events","type":"User","site_admin":false},"body":"A proposal for a published spec of the JSON we output. V0 is the original format (with some fixes ensuring it is valid JSON), V1 is the proposed one. \r\n\r\nV2 will contain more goodies from the datasets API but V1 is what we are on.\r\n\r\nThis PR also contains codecs for the V0 and V1 formats and automated tests to verify that the codecs work on the examples","created_at":"2016-07-11T01:28:07Z","updated_at":"2016-07-11T06:07:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8d5f373a2b17da422ded7403b44f67068e13c04d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/CommBank/coppersmith/pulls/40/commits","review_comments_url":"https://api.github.com/repos/CommBank/coppersmith/pulls/40/comments","review_comment_url":"https://api.github.com/repos/CommBank/coppersmith/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CommBank/coppersmith/issues/40/comments","statuses_url":"https://api.github.com/repos/CommBank/coppersmith/statuses/862ceeebe0abe1fbb8931bef2dff68c3367ae4b4","head":{"label":"CommBank:json_spec","ref":"json_spec","sha":"862ceeebe0abe1fbb8931bef2dff68c3367ae4b4","user":{"login":"CommBank","id":4240076,"avatar_url":"https://avatars.githubusercontent.com/u/4240076?v=3","gravatar_id":"","url":"https://api.github.com/users/CommBank","html_url":"https://github.com/CommBank","followers_url":"https://api.github.com/users/CommBank/followers","following_url":"https://api.github.com/users/CommBank/following{/other_user}","gists_url":"https://api.github.com/users/CommBank/gists{/gist_id}","starred_url":"https://api.github.com/users/CommBank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CommBank/subscriptions","organizations_url":"https://api.github.com/users/CommBank/orgs","repos_url":"https://api.github.com/users/CommBank/repos","events_url":"https://api.github.com/users/CommBank/events{/privacy}","received_events_url":"https://api.github.com/users/CommBank/received_events","type":"Organization","site_admin":false},"repo":{"id":55942036,"name":"coppersmith","full_name":"CommBank/coppersmith","owner":{"login":"CommBank","id":4240076,"avatar_url":"https://avatars.githubusercontent.com/u/4240076?v=3","gravatar_id":"","url":"https://api.github.com/users/CommBank","html_url":"https://github.com/CommBank","followers_url":"https://api.github.com/users/CommBank/followers","following_url":"https://api.github.com/users/CommBank/following{/other_user}","gists_url":"https://api.github.com/users/CommBank/gists{/gist_id}","starred_url":"https://api.github.com/users/CommBank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CommBank/subscriptions","organizations_url":"https://api.github.com/users/CommBank/orgs","repos_url":"https://api.github.com/users/CommBank/repos","events_url":"https://api.github.com/users/CommBank/events{/privacy}","received_events_url":"https://api.github.com/users/CommBank/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CommBank/coppersmith","description":"Feature Engineering as Composable Functions","fork":false,"url":"https://api.github.com/repos/CommBank/coppersmith","forks_url":"https://api.github.com/repos/CommBank/coppersmith/forks","keys_url":"https://api.github.com/repos/CommBank/coppersmith/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CommBank/coppersmith/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CommBank/coppersmith/teams","hooks_url":"https://api.github.com/repos/CommBank/coppersmith/hooks","issue_events_url":"https://api.github.com/repos/CommBank/coppersmith/issues/events{/number}","events_url":"https://api.github.com/repos/CommBank/coppersmith/events","assignees_url":"https://api.github.com/repos/CommBank/coppersmith/assignees{/user}","branches_url":"https://api.github.com/repos/CommBank/coppersmith/branches{/branch}","tags_url":"https://api.github.com/repos/CommBank/coppersmith/tags","blobs_url":"https://api.github.com/repos/CommBank/coppersmith/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CommBank/coppersmith/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CommBank/coppersmith/git/refs{/sha}","trees_url":"https://api.github.com/repos/CommBank/coppersmith/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CommBank/coppersmith/statuses/{sha}","languages_url":"https://api.github.com/repos/CommBank/coppersmith/languages","stargazers_url":"https://api.github.com/repos/CommBank/coppersmith/stargazers","contributors_url":"https://api.github.com/repos/CommBank/coppersmith/contributors","subscribers_url":"https://api.github.com/repos/CommBank/coppersmith/subscribers","subscription_url":"https://api.github.com/repos/CommBank/coppersmith/subscription","commits_url":"https://api.github.com/repos/CommBank/coppersmith/commits{/sha}","git_commits_url":"https://api.github.com/repos/CommBank/coppersmith/git/commits{/sha}","comments_url":"https://api.github.com/repos/CommBank/coppersmith/comments{/number}","issue_comment_url":"https://api.github.com/repos/CommBank/coppersmith/issues/comments{/number}","contents_url":"https://api.github.com/repos/CommBank/coppersmith/contents/{+path}","compare_url":"https://api.github.com/repos/CommBank/coppersmith/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CommBank/coppersmith/merges","archive_url":"https://api.github.com/repos/CommBank/coppersmith/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CommBank/coppersmith/downloads","issues_url":"https://api.github.com/repos/CommBank/coppersmith/issues{/number}","pulls_url":"https://api.github.com/repos/CommBank/coppersmith/pulls{/number}","milestones_url":"https://api.github.com/repos/CommBank/coppersmith/milestones{/number}","notifications_url":"https://api.github.com/repos/CommBank/coppersmith/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CommBank/coppersmith/labels{/name}","releases_url":"https://api.github.com/repos/CommBank/coppersmith/releases{/id}","deployments_url":"https://api.github.com/repos/CommBank/coppersmith/deployments","created_at":"2016-04-11T04:38:16Z","updated_at":"2016-07-07T05:45:08Z","pushed_at":"2016-07-11T04:27:38Z","git_url":"git://github.com/CommBank/coppersmith.git","ssh_url":"git@github.com:CommBank/coppersmith.git","clone_url":"https://github.com/CommBank/coppersmith.git","svn_url":"https://github.com/CommBank/coppersmith","homepage":null,"size":963,"stargazers_count":17,"watchers_count":17,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":6,"mirror_url":null,"open_issues_count":4,"forks":6,"open_issues":4,"watchers":17,"default_branch":"master"}},"base":{"label":"CommBank:master","ref":"master","sha":"09543c1703e19dfa302fc6659ae323a19becece9","user":{"login":"CommBank","id":4240076,"avatar_url":"https://avatars.githubusercontent.com/u/4240076?v=3","gravatar_id":"","url":"https://api.github.com/users/CommBank","html_url":"https://github.com/CommBank","followers_url":"https://api.github.com/users/CommBank/followers","following_url":"https://api.github.com/users/CommBank/following{/other_user}","gists_url":"https://api.github.com/users/CommBank/gists{/gist_id}","starred_url":"https://api.github.com/users/CommBank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CommBank/subscriptions","organizations_url":"https://api.github.com/users/CommBank/orgs","repos_url":"https://api.github.com/users/CommBank/repos","events_url":"https://api.github.com/users/CommBank/events{/privacy}","received_events_url":"https://api.github.com/users/CommBank/received_events","type":"Organization","site_admin":false},"repo":{"id":55942036,"name":"coppersmith","full_name":"CommBank/coppersmith","owner":{"login":"CommBank","id":4240076,"avatar_url":"https://avatars.githubusercontent.com/u/4240076?v=3","gravatar_id":"","url":"https://api.github.com/users/CommBank","html_url":"https://github.com/CommBank","followers_url":"https://api.github.com/users/CommBank/followers","following_url":"https://api.github.com/users/CommBank/following{/other_user}","gists_url":"https://api.github.com/users/CommBank/gists{/gist_id}","starred_url":"https://api.github.com/users/CommBank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CommBank/subscriptions","organizations_url":"https://api.github.com/users/CommBank/orgs","repos_url":"https://api.github.com/users/CommBank/repos","events_url":"https://api.github.com/users/CommBank/events{/privacy}","received_events_url":"https://api.github.com/users/CommBank/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CommBank/coppersmith","description":"Feature Engineering as Composable Functions","fork":false,"url":"https://api.github.com/repos/CommBank/coppersmith","forks_url":"https://api.github.com/repos/CommBank/coppersmith/forks","keys_url":"https://api.github.com/repos/CommBank/coppersmith/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CommBank/coppersmith/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CommBank/coppersmith/teams","hooks_url":"https://api.github.com/repos/CommBank/coppersmith/hooks","issue_events_url":"https://api.github.com/repos/CommBank/coppersmith/issues/events{/number}","events_url":"https://api.github.com/repos/CommBank/coppersmith/events","assignees_url":"https://api.github.com/repos/CommBank/coppersmith/assignees{/user}","branches_url":"https://api.github.com/repos/CommBank/coppersmith/branches{/branch}","tags_url":"https://api.github.com/repos/CommBank/coppersmith/tags","blobs_url":"https://api.github.com/repos/CommBank/coppersmith/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CommBank/coppersmith/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CommBank/coppersmith/git/refs{/sha}","trees_url":"https://api.github.com/repos/CommBank/coppersmith/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CommBank/coppersmith/statuses/{sha}","languages_url":"https://api.github.com/repos/CommBank/coppersmith/languages","stargazers_url":"https://api.github.com/repos/CommBank/coppersmith/stargazers","contributors_url":"https://api.github.com/repos/CommBank/coppersmith/contributors","subscribers_url":"https://api.github.com/repos/CommBank/coppersmith/subscribers","subscription_url":"https://api.github.com/repos/CommBank/coppersmith/subscription","commits_url":"https://api.github.com/repos/CommBank/coppersmith/commits{/sha}","git_commits_url":"https://api.github.com/repos/CommBank/coppersmith/git/commits{/sha}","comments_url":"https://api.github.com/repos/CommBank/coppersmith/comments{/number}","issue_comment_url":"https://api.github.com/repos/CommBank/coppersmith/issues/comments{/number}","contents_url":"https://api.github.com/repos/CommBank/coppersmith/contents/{+path}","compare_url":"https://api.github.com/repos/CommBank/coppersmith/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CommBank/coppersmith/merges","archive_url":"https://api.github.com/repos/CommBank/coppersmith/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CommBank/coppersmith/downloads","issues_url":"https://api.github.com/repos/CommBank/coppersmith/issues{/number}","pulls_url":"https://api.github.com/repos/CommBank/coppersmith/pulls{/number}","milestones_url":"https://api.github.com/repos/CommBank/coppersmith/milestones{/number}","notifications_url":"https://api.github.com/repos/CommBank/coppersmith/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CommBank/coppersmith/labels{/name}","releases_url":"https://api.github.com/repos/CommBank/coppersmith/releases{/id}","deployments_url":"https://api.github.com/repos/CommBank/coppersmith/deployments","created_at":"2016-04-11T04:38:16Z","updated_at":"2016-07-07T05:45:08Z","pushed_at":"2016-07-11T04:27:38Z","git_url":"git://github.com/CommBank/coppersmith.git","ssh_url":"git@github.com:CommBank/coppersmith.git","clone_url":"https://github.com/CommBank/coppersmith.git","svn_url":"https://github.com/CommBank/coppersmith","homepage":null,"size":963,"stargazers_count":17,"watchers_count":17,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":6,"mirror_url":null,"open_issues_count":4,"forks":6,"open_issues":4,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CommBank/coppersmith/pulls/40"},"html":{"href":"https://github.com/CommBank/coppersmith/pull/40"},"issue":{"href":"https://api.github.com/repos/CommBank/coppersmith/issues/40"},"comments":{"href":"https://api.github.com/repos/CommBank/coppersmith/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/CommBank/coppersmith/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/CommBank/coppersmith/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CommBank/coppersmith/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/CommBank/coppersmith/statuses/862ceeebe0abe1fbb8931bef2dff68c3367ae4b4"}}}}
{"actor":{"display_login":"dkristian"}}