{"action":"created","comment":{"url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/pulls/comments/77865982","id":77865982,"diff_hunk":"@@ -0,0 +1,22 @@\n+export var schema = {\n+  \"title\": \"Enum\",\n+  \"type\": \"object\",\n+  \"properties\": {\n+    \"bar\": {\n+      \"type\": \"string\",\n+      \"enum\": [\"foo\", 2, 3],\n+      \"tsEnumNames\": [\"One\",\"Two\",\"Three\"]\n+    }\n+  },\n+  \"required\": [\"bar\"],\n+  \"additionalProperties\": false\n+}\n+\n+export var settings = {\n+  useTypescriptEnums: true\n+}\n+\n+export var error = {","path":"test/cases/enumValidation.1.ts","position":19,"original_position":19,"commit_id":"c40f07f4861c69c9895995a40aa5ef7455c6dd38","original_commit_id":"c40f07f4861c69c9895995a40aa5ef7455c6dd38","user":{"login":"bcherny","id":1761758,"avatar_url":"https://avatars.githubusercontent.com/u/1761758?v=3","gravatar_id":"","url":"https://api.github.com/users/bcherny","html_url":"https://github.com/bcherny","followers_url":"https://api.github.com/users/bcherny/followers","following_url":"https://api.github.com/users/bcherny/following{/other_user}","gists_url":"https://api.github.com/users/bcherny/gists{/gist_id}","starred_url":"https://api.github.com/users/bcherny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcherny/subscriptions","organizations_url":"https://api.github.com/users/bcherny/orgs","repos_url":"https://api.github.com/users/bcherny/repos","events_url":"https://api.github.com/users/bcherny/events{/privacy}","received_events_url":"https://api.github.com/users/bcherny/received_events","type":"User","site_admin":false},"body":"nice","created_at":"2016-09-07T17:15:27Z","updated_at":"2016-09-07T17:15:27Z","html_url":"https://github.com/bcherny/json-schema-to-typescript/pull/15#discussion_r77865982","pull_request_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/bcherny/json-schema-to-typescript/pulls/comments/77865982"},"html":{"href":"https://github.com/bcherny/json-schema-to-typescript/pull/15#discussion_r77865982"},"pull_request":{"href":"https://api.github.com/repos/bcherny/json-schema-to-typescript/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/pulls/15","id":83152915,"html_url":"https://github.com/bcherny/json-schema-to-typescript/pull/15","diff_url":"https://github.com/bcherny/json-schema-to-typescript/pull/15.diff","patch_url":"https://github.com/bcherny/json-schema-to-typescript/pull/15.patch","issue_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/issues/15","number":15,"state":"open","locked":false,"title":"Add ts enums","user":{"login":"jcogilvie","id":679297,"avatar_url":"https://avatars.githubusercontent.com/u/679297?v=3","gravatar_id":"","url":"https://api.github.com/users/jcogilvie","html_url":"https://github.com/jcogilvie","followers_url":"https://api.github.com/users/jcogilvie/followers","following_url":"https://api.github.com/users/jcogilvie/following{/other_user}","gists_url":"https://api.github.com/users/jcogilvie/gists{/gist_id}","starred_url":"https://api.github.com/users/jcogilvie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcogilvie/subscriptions","organizations_url":"https://api.github.com/users/jcogilvie/orgs","repos_url":"https://api.github.com/users/jcogilvie/repos","events_url":"https://api.github.com/users/jcogilvie/events{/privacy}","received_events_url":"https://api.github.com/users/jcogilvie/received_events","type":"User","site_admin":false},"body":"I added a few things here (with tests):\r\n\r\n1) ability to reference other .json files (locally) with `$ref`, and choose whether to have the referenced types declared with the existing `declareReferenced` option.\r\n2) option to export the generated interfaces\r\n3) fall back to filename for naming something without ID or title\r\n4) option to generate ts enums (int-backed instead of string union) and additionally a proprietary schema extension `tsEnumNames` so that you can specify which integers to use, if you care, like so:\r\n\r\n````\r\nenum: [1, 2, 3]\r\ntsEnumNames: [\"one\", \"two\", \"three\"]\r\n````\r\n\r\nThis will generate\r\n````\r\nenum Whatever {\r\n    one=1,\r\n    two=2,\r\n    three=3\r\n}\r\n````\r\n\r\nAdditionally any nested enums will be extracted into top-level types.","created_at":"2016-08-29T19:26:06Z","updated_at":"2016-09-07T17:15:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"35f0e2da93f8befc17ca739c22436529c5638f30","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/pulls/15/commits","review_comments_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/pulls/15/comments","review_comment_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/issues/15/comments","statuses_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/statuses/c40f07f4861c69c9895995a40aa5ef7455c6dd38","head":{"label":"MyPureCloud:add-ts-enums","ref":"add-ts-enums","sha":"c40f07f4861c69c9895995a40aa5ef7455c6dd38","user":{"login":"MyPureCloud","id":8524313,"avatar_url":"https://avatars.githubusercontent.com/u/8524313?v=3","gravatar_id":"","url":"https://api.github.com/users/MyPureCloud","html_url":"https://github.com/MyPureCloud","followers_url":"https://api.github.com/users/MyPureCloud/followers","following_url":"https://api.github.com/users/MyPureCloud/following{/other_user}","gists_url":"https://api.github.com/users/MyPureCloud/gists{/gist_id}","starred_url":"https://api.github.com/users/MyPureCloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MyPureCloud/subscriptions","organizations_url":"https://api.github.com/users/MyPureCloud/orgs","repos_url":"https://api.github.com/users/MyPureCloud/repos","events_url":"https://api.github.com/users/MyPureCloud/events{/privacy}","received_events_url":"https://api.github.com/users/MyPureCloud/received_events","type":"Organization","site_admin":false},"repo":{"id":66393784,"name":"json-schema-to-typescript","full_name":"MyPureCloud/json-schema-to-typescript","owner":{"login":"MyPureCloud","id":8524313,"avatar_url":"https://avatars.githubusercontent.com/u/8524313?v=3","gravatar_id":"","url":"https://api.github.com/users/MyPureCloud","html_url":"https://github.com/MyPureCloud","followers_url":"https://api.github.com/users/MyPureCloud/followers","following_url":"https://api.github.com/users/MyPureCloud/following{/other_user}","gists_url":"https://api.github.com/users/MyPureCloud/gists{/gist_id}","starred_url":"https://api.github.com/users/MyPureCloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MyPureCloud/subscriptions","organizations_url":"https://api.github.com/users/MyPureCloud/orgs","repos_url":"https://api.github.com/users/MyPureCloud/repos","events_url":"https://api.github.com/users/MyPureCloud/events{/privacy}","received_events_url":"https://api.github.com/users/MyPureCloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MyPureCloud/json-schema-to-typescript","description":"compile json schema to typescript typings","fork":true,"url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript","forks_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/forks","keys_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/teams","hooks_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/hooks","issue_events_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/issues/events{/number}","events_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/events","assignees_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/assignees{/user}","branches_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/branches{/branch}","tags_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/tags","blobs_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/git/refs{/sha}","trees_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/statuses/{sha}","languages_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/languages","stargazers_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/stargazers","contributors_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/contributors","subscribers_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/subscribers","subscription_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/subscription","commits_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/commits{/sha}","git_commits_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/git/commits{/sha}","comments_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/comments{/number}","issue_comment_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/issues/comments{/number}","contents_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/contents/{+path}","compare_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/merges","archive_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/downloads","issues_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/issues{/number}","pulls_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/pulls{/number}","milestones_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/milestones{/number}","notifications_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/labels{/name}","releases_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/releases{/id}","deployments_url":"https://api.github.com/repos/MyPureCloud/json-schema-to-typescript/deployments","created_at":"2016-08-23T18:44:14Z","updated_at":"2016-08-23T18:44:15Z","pushed_at":"2016-09-07T16:31:43Z","git_url":"git://github.com/MyPureCloud/json-schema-to-typescript.git","ssh_url":"git@github.com:MyPureCloud/json-schema-to-typescript.git","clone_url":"https://github.com/MyPureCloud/json-schema-to-typescript.git","svn_url":"https://github.com/MyPureCloud/json-schema-to-typescript","homepage":null,"size":155,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"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":"bcherny:master","ref":"master","sha":"608a91ff493ba99274eb99e2dd2c342ad3e08017","user":{"login":"bcherny","id":1761758,"avatar_url":"https://avatars.githubusercontent.com/u/1761758?v=3","gravatar_id":"","url":"https://api.github.com/users/bcherny","html_url":"https://github.com/bcherny","followers_url":"https://api.github.com/users/bcherny/followers","following_url":"https://api.github.com/users/bcherny/following{/other_user}","gists_url":"https://api.github.com/users/bcherny/gists{/gist_id}","starred_url":"https://api.github.com/users/bcherny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcherny/subscriptions","organizations_url":"https://api.github.com/users/bcherny/orgs","repos_url":"https://api.github.com/users/bcherny/repos","events_url":"https://api.github.com/users/bcherny/events{/privacy}","received_events_url":"https://api.github.com/users/bcherny/received_events","type":"User","site_admin":false},"repo":{"id":54443780,"name":"json-schema-to-typescript","full_name":"bcherny/json-schema-to-typescript","owner":{"login":"bcherny","id":1761758,"avatar_url":"https://avatars.githubusercontent.com/u/1761758?v=3","gravatar_id":"","url":"https://api.github.com/users/bcherny","html_url":"https://github.com/bcherny","followers_url":"https://api.github.com/users/bcherny/followers","following_url":"https://api.github.com/users/bcherny/following{/other_user}","gists_url":"https://api.github.com/users/bcherny/gists{/gist_id}","starred_url":"https://api.github.com/users/bcherny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcherny/subscriptions","organizations_url":"https://api.github.com/users/bcherny/orgs","repos_url":"https://api.github.com/users/bcherny/repos","events_url":"https://api.github.com/users/bcherny/events{/privacy}","received_events_url":"https://api.github.com/users/bcherny/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bcherny/json-schema-to-typescript","description":"compile json schema to typescript typings","fork":false,"url":"https://api.github.com/repos/bcherny/json-schema-to-typescript","forks_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/forks","keys_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/teams","hooks_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/hooks","issue_events_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/issues/events{/number}","events_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/events","assignees_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/assignees{/user}","branches_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/branches{/branch}","tags_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/tags","blobs_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/git/refs{/sha}","trees_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/statuses/{sha}","languages_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/languages","stargazers_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/stargazers","contributors_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/contributors","subscribers_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/subscribers","subscription_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/subscription","commits_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/commits{/sha}","git_commits_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/git/commits{/sha}","comments_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/comments{/number}","issue_comment_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/issues/comments{/number}","contents_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/contents/{+path}","compare_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/merges","archive_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/downloads","issues_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/issues{/number}","pulls_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/pulls{/number}","milestones_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/milestones{/number}","notifications_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/labels{/name}","releases_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/releases{/id}","deployments_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/deployments","created_at":"2016-03-22T03:56:58Z","updated_at":"2016-08-29T07:31:54Z","pushed_at":"2016-09-07T15:46:36Z","git_url":"git://github.com/bcherny/json-schema-to-typescript.git","ssh_url":"git@github.com:bcherny/json-schema-to-typescript.git","clone_url":"https://github.com/bcherny/json-schema-to-typescript.git","svn_url":"https://github.com/bcherny/json-schema-to-typescript","homepage":null,"size":162,"stargazers_count":12,"watchers_count":12,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":12,"forks":4,"open_issues":12,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bcherny/json-schema-to-typescript/pulls/15"},"html":{"href":"https://github.com/bcherny/json-schema-to-typescript/pull/15"},"issue":{"href":"https://api.github.com/repos/bcherny/json-schema-to-typescript/issues/15"},"comments":{"href":"https://api.github.com/repos/bcherny/json-schema-to-typescript/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/bcherny/json-schema-to-typescript/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/bcherny/json-schema-to-typescript/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bcherny/json-schema-to-typescript/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/bcherny/json-schema-to-typescript/statuses/c40f07f4861c69c9895995a40aa5ef7455c6dd38"}}}}
{"actor":{"display_login":"bcherny"}}