{"action":"opened","number":360,"pull_request":{"url":"https://api.github.com/repos/dart-lang/json_serializable/pulls/360","id":237238755,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM3MjM4NzU1","html_url":"https://github.com/dart-lang/json_serializable/pull/360","diff_url":"https://github.com/dart-lang/json_serializable/pull/360.diff","patch_url":"https://github.com/dart-lang/json_serializable/pull/360.patch","issue_url":"https://api.github.com/repos/dart-lang/json_serializable/issues/360","number":360,"state":"open","locked":false,"title":"Return defaultValue for unsupported enum instead throw exception","user":{"login":"beastoin","id":4256921,"node_id":"MDQ6VXNlcjQyNTY5MjE=","avatar_url":"https://avatars0.githubusercontent.com/u/4256921?v=4","gravatar_id":"","url":"https://api.github.com/users/beastoin","html_url":"https://github.com/beastoin","followers_url":"https://api.github.com/users/beastoin/followers","following_url":"https://api.github.com/users/beastoin/following{/other_user}","gists_url":"https://api.github.com/users/beastoin/gists{/gist_id}","starred_url":"https://api.github.com/users/beastoin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beastoin/subscriptions","organizations_url":"https://api.github.com/users/beastoin/orgs","repos_url":"https://api.github.com/users/beastoin/repos","events_url":"https://api.github.com/users/beastoin/events{/privacy}","received_events_url":"https://api.github.com/users/beastoin/received_events","type":"User","site_admin":false},"body":"For enum type, I think we should use `nullable` option for both `null` and nonexistent value. \r\n\r\nIn our case, we have object Coupon which contains CouponType as type of specific Coupon. At the very first time, our CouponType is only `loship_promotion`. We also support unknown CouponType from UI, which showing a message for updating the application. And now, we have `merchant_promotion`  as a new type. Of course, the number of CouponType's values can be increased in the future. So we need to define the parser for unknown type, and I think this is a common case in the real world.\r\n\r\nI'm trying to use `nullable` and `defaultValue` options for enum, but my code throws the exception because of unsupported values.\r\n\r\n[json_serializable/json_annotation/lib/src/json_key.dart](json_key.dart)\r\n` /// When `true`, `null` values are handled gracefully when\r\n  /// serializing the field to JSON and when deserializing `null` and\r\n  /// nonexistent values from a JSON map.\r\n  ///\r\n  /// Setting to `false` eliminates `null` verification in the generated code\r\n  /// for the annotated field, which reduces the code size. Errors may be thrown\r\n  /// at runtime if `null` values are encountered, but the original class should\r\n  /// also implement `null` runtime validation if it's critical.\r\n  ///\r\n  /// The default value, `null`, indicates that the behavior should be\r\n  /// acquired from the [JsonSerializable.nullable] annotation on the\r\n  /// enclosing class.\r\n  final bool nullable;`\r\n\r\n","created_at":"2018-12-10T08:47:33Z","updated_at":"2018-12-10T08:47:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dart-lang/json_serializable/pulls/360/commits","review_comments_url":"https://api.github.com/repos/dart-lang/json_serializable/pulls/360/comments","review_comment_url":"https://api.github.com/repos/dart-lang/json_serializable/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dart-lang/json_serializable/issues/360/comments","statuses_url":"https://api.github.com/repos/dart-lang/json_serializable/statuses/b35520bef10802b48fd402dd0ff6e43ec2831061","head":{"label":"beastoin:support_unknown_value_enum","ref":"support_unknown_value_enum","sha":"b35520bef10802b48fd402dd0ff6e43ec2831061","user":{"login":"beastoin","id":4256921,"node_id":"MDQ6VXNlcjQyNTY5MjE=","avatar_url":"https://avatars0.githubusercontent.com/u/4256921?v=4","gravatar_id":"","url":"https://api.github.com/users/beastoin","html_url":"https://github.com/beastoin","followers_url":"https://api.github.com/users/beastoin/followers","following_url":"https://api.github.com/users/beastoin/following{/other_user}","gists_url":"https://api.github.com/users/beastoin/gists{/gist_id}","starred_url":"https://api.github.com/users/beastoin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beastoin/subscriptions","organizations_url":"https://api.github.com/users/beastoin/orgs","repos_url":"https://api.github.com/users/beastoin/repos","events_url":"https://api.github.com/users/beastoin/events{/privacy}","received_events_url":"https://api.github.com/users/beastoin/received_events","type":"User","site_admin":false},"repo":{"id":159656920,"node_id":"MDEwOlJlcG9zaXRvcnkxNTk2NTY5MjA=","name":"json_serializable","full_name":"beastoin/json_serializable","private":false,"owner":{"login":"beastoin","id":4256921,"node_id":"MDQ6VXNlcjQyNTY5MjE=","avatar_url":"https://avatars0.githubusercontent.com/u/4256921?v=4","gravatar_id":"","url":"https://api.github.com/users/beastoin","html_url":"https://github.com/beastoin","followers_url":"https://api.github.com/users/beastoin/followers","following_url":"https://api.github.com/users/beastoin/following{/other_user}","gists_url":"https://api.github.com/users/beastoin/gists{/gist_id}","starred_url":"https://api.github.com/users/beastoin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beastoin/subscriptions","organizations_url":"https://api.github.com/users/beastoin/orgs","repos_url":"https://api.github.com/users/beastoin/repos","events_url":"https://api.github.com/users/beastoin/events{/privacy}","received_events_url":"https://api.github.com/users/beastoin/received_events","type":"User","site_admin":false},"html_url":"https://github.com/beastoin/json_serializable","description":"Generates utilities to aid in serializing to/from JSON.","fork":true,"url":"https://api.github.com/repos/beastoin/json_serializable","forks_url":"https://api.github.com/repos/beastoin/json_serializable/forks","keys_url":"https://api.github.com/repos/beastoin/json_serializable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/beastoin/json_serializable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/beastoin/json_serializable/teams","hooks_url":"https://api.github.com/repos/beastoin/json_serializable/hooks","issue_events_url":"https://api.github.com/repos/beastoin/json_serializable/issues/events{/number}","events_url":"https://api.github.com/repos/beastoin/json_serializable/events","assignees_url":"https://api.github.com/repos/beastoin/json_serializable/assignees{/user}","branches_url":"https://api.github.com/repos/beastoin/json_serializable/branches{/branch}","tags_url":"https://api.github.com/repos/beastoin/json_serializable/tags","blobs_url":"https://api.github.com/repos/beastoin/json_serializable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/beastoin/json_serializable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/beastoin/json_serializable/git/refs{/sha}","trees_url":"https://api.github.com/repos/beastoin/json_serializable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/beastoin/json_serializable/statuses/{sha}","languages_url":"https://api.github.com/repos/beastoin/json_serializable/languages","stargazers_url":"https://api.github.com/repos/beastoin/json_serializable/stargazers","contributors_url":"https://api.github.com/repos/beastoin/json_serializable/contributors","subscribers_url":"https://api.github.com/repos/beastoin/json_serializable/subscribers","subscription_url":"https://api.github.com/repos/beastoin/json_serializable/subscription","commits_url":"https://api.github.com/repos/beastoin/json_serializable/commits{/sha}","git_commits_url":"https://api.github.com/repos/beastoin/json_serializable/git/commits{/sha}","comments_url":"https://api.github.com/repos/beastoin/json_serializable/comments{/number}","issue_comment_url":"https://api.github.com/repos/beastoin/json_serializable/issues/comments{/number}","contents_url":"https://api.github.com/repos/beastoin/json_serializable/contents/{+path}","compare_url":"https://api.github.com/repos/beastoin/json_serializable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/beastoin/json_serializable/merges","archive_url":"https://api.github.com/repos/beastoin/json_serializable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/beastoin/json_serializable/downloads","issues_url":"https://api.github.com/repos/beastoin/json_serializable/issues{/number}","pulls_url":"https://api.github.com/repos/beastoin/json_serializable/pulls{/number}","milestones_url":"https://api.github.com/repos/beastoin/json_serializable/milestones{/number}","notifications_url":"https://api.github.com/repos/beastoin/json_serializable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/beastoin/json_serializable/labels{/name}","releases_url":"https://api.github.com/repos/beastoin/json_serializable/releases{/id}","deployments_url":"https://api.github.com/repos/beastoin/json_serializable/deployments","created_at":"2018-11-29T11:40:03Z","updated_at":"2018-11-29T11:40:06Z","pushed_at":"2018-12-10T08:15:40Z","git_url":"git://github.com/beastoin/json_serializable.git","ssh_url":"git@github.com:beastoin/json_serializable.git","clone_url":"https://github.com/beastoin/json_serializable.git","svn_url":"https://github.com/beastoin/json_serializable","homepage":"https://pub.dartlang.org/packages/json_serializable","size":1165,"stargazers_count":0,"watchers_count":0,"language":"Dart","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dart-lang:master","ref":"master","sha":"91614af85ba9e95d7843c1facda8f930924bae10","user":{"login":"dart-lang","id":1609975,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDk5NzU=","avatar_url":"https://avatars0.githubusercontent.com/u/1609975?v=4","gravatar_id":"","url":"https://api.github.com/users/dart-lang","html_url":"https://github.com/dart-lang","followers_url":"https://api.github.com/users/dart-lang/followers","following_url":"https://api.github.com/users/dart-lang/following{/other_user}","gists_url":"https://api.github.com/users/dart-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/dart-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dart-lang/subscriptions","organizations_url":"https://api.github.com/users/dart-lang/orgs","repos_url":"https://api.github.com/users/dart-lang/repos","events_url":"https://api.github.com/users/dart-lang/events{/privacy}","received_events_url":"https://api.github.com/users/dart-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":97642471,"node_id":"MDEwOlJlcG9zaXRvcnk5NzY0MjQ3MQ==","name":"json_serializable","full_name":"dart-lang/json_serializable","private":false,"owner":{"login":"dart-lang","id":1609975,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDk5NzU=","avatar_url":"https://avatars0.githubusercontent.com/u/1609975?v=4","gravatar_id":"","url":"https://api.github.com/users/dart-lang","html_url":"https://github.com/dart-lang","followers_url":"https://api.github.com/users/dart-lang/followers","following_url":"https://api.github.com/users/dart-lang/following{/other_user}","gists_url":"https://api.github.com/users/dart-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/dart-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dart-lang/subscriptions","organizations_url":"https://api.github.com/users/dart-lang/orgs","repos_url":"https://api.github.com/users/dart-lang/repos","events_url":"https://api.github.com/users/dart-lang/events{/privacy}","received_events_url":"https://api.github.com/users/dart-lang/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/dart-lang/json_serializable","description":"Generates utilities to aid in serializing to/from JSON.","fork":false,"url":"https://api.github.com/repos/dart-lang/json_serializable","forks_url":"https://api.github.com/repos/dart-lang/json_serializable/forks","keys_url":"https://api.github.com/repos/dart-lang/json_serializable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dart-lang/json_serializable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dart-lang/json_serializable/teams","hooks_url":"https://api.github.com/repos/dart-lang/json_serializable/hooks","issue_events_url":"https://api.github.com/repos/dart-lang/json_serializable/issues/events{/number}","events_url":"https://api.github.com/repos/dart-lang/json_serializable/events","assignees_url":"https://api.github.com/repos/dart-lang/json_serializable/assignees{/user}","branches_url":"https://api.github.com/repos/dart-lang/json_serializable/branches{/branch}","tags_url":"https://api.github.com/repos/dart-lang/json_serializable/tags","blobs_url":"https://api.github.com/repos/dart-lang/json_serializable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dart-lang/json_serializable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dart-lang/json_serializable/git/refs{/sha}","trees_url":"https://api.github.com/repos/dart-lang/json_serializable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dart-lang/json_serializable/statuses/{sha}","languages_url":"https://api.github.com/repos/dart-lang/json_serializable/languages","stargazers_url":"https://api.github.com/repos/dart-lang/json_serializable/stargazers","contributors_url":"https://api.github.com/repos/dart-lang/json_serializable/contributors","subscribers_url":"https://api.github.com/repos/dart-lang/json_serializable/subscribers","subscription_url":"https://api.github.com/repos/dart-lang/json_serializable/subscription","commits_url":"https://api.github.com/repos/dart-lang/json_serializable/commits{/sha}","git_commits_url":"https://api.github.com/repos/dart-lang/json_serializable/git/commits{/sha}","comments_url":"https://api.github.com/repos/dart-lang/json_serializable/comments{/number}","issue_comment_url":"https://api.github.com/repos/dart-lang/json_serializable/issues/comments{/number}","contents_url":"https://api.github.com/repos/dart-lang/json_serializable/contents/{+path}","compare_url":"https://api.github.com/repos/dart-lang/json_serializable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dart-lang/json_serializable/merges","archive_url":"https://api.github.com/repos/dart-lang/json_serializable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dart-lang/json_serializable/downloads","issues_url":"https://api.github.com/repos/dart-lang/json_serializable/issues{/number}","pulls_url":"https://api.github.com/repos/dart-lang/json_serializable/pulls{/number}","milestones_url":"https://api.github.com/repos/dart-lang/json_serializable/milestones{/number}","notifications_url":"https://api.github.com/repos/dart-lang/json_serializable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dart-lang/json_serializable/labels{/name}","releases_url":"https://api.github.com/repos/dart-lang/json_serializable/releases{/id}","deployments_url":"https://api.github.com/repos/dart-lang/json_serializable/deployments","created_at":"2017-07-18T20:48:49Z","updated_at":"2018-12-09T19:23:02Z","pushed_at":"2018-12-07T22:25:38Z","git_url":"git://github.com/dart-lang/json_serializable.git","ssh_url":"git@github.com:dart-lang/json_serializable.git","clone_url":"https://github.com/dart-lang/json_serializable.git","svn_url":"https://github.com/dart-lang/json_serializable","homepage":"https://pub.dartlang.org/packages/json_serializable","size":1189,"stargazers_count":144,"watchers_count":144,"language":"Dart","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":34,"mirror_url":null,"archived":false,"open_issues_count":22,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":34,"open_issues":22,"watchers":144,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dart-lang/json_serializable/pulls/360"},"html":{"href":"https://github.com/dart-lang/json_serializable/pull/360"},"issue":{"href":"https://api.github.com/repos/dart-lang/json_serializable/issues/360"},"comments":{"href":"https://api.github.com/repos/dart-lang/json_serializable/issues/360/comments"},"review_comments":{"href":"https://api.github.com/repos/dart-lang/json_serializable/pulls/360/comments"},"review_comment":{"href":"https://api.github.com/repos/dart-lang/json_serializable/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dart-lang/json_serializable/pulls/360/commits"},"statuses":{"href":"https://api.github.com/repos/dart-lang/json_serializable/statuses/b35520bef10802b48fd402dd0ff6e43ec2831061"}},"author_association":"NONE","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":3,"deletions":0,"changed_files":1}}
{"actor":{"display_login":"beastoin"}}