{"action":"created","issue":{"url":"https://api.github.com/repos/dcodeIO/protobuf.js/issues/521","repository_url":"https://api.github.com/repos/dcodeIO/protobuf.js","labels_url":"https://api.github.com/repos/dcodeIO/protobuf.js/issues/521/labels{/name}","comments_url":"https://api.github.com/repos/dcodeIO/protobuf.js/issues/521/comments","events_url":"https://api.github.com/repos/dcodeIO/protobuf.js/issues/521/events","html_url":"https://github.com/dcodeIO/protobuf.js/issues/521","id":193948464,"number":521,"title":"protobuf.js decode object missing some field when the field have default value","user":{"login":"dbskccc","id":15682369,"avatar_url":"https://avatars.githubusercontent.com/u/15682369?v=3","gravatar_id":"","url":"https://api.github.com/users/dbskccc","html_url":"https://github.com/dbskccc","followers_url":"https://api.github.com/users/dbskccc/followers","following_url":"https://api.github.com/users/dbskccc/following{/other_user}","gists_url":"https://api.github.com/users/dbskccc/gists{/gist_id}","starred_url":"https://api.github.com/users/dbskccc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbskccc/subscriptions","organizations_url":"https://api.github.com/users/dbskccc/orgs","repos_url":"https://api.github.com/users/dbskccc/repos","events_url":"https://api.github.com/users/dbskccc/events{/privacy}","received_events_url":"https://api.github.com/users/dbskccc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-07T03:23:31Z","updated_at":"2016-12-07T10:33:46Z","closed_at":null,"body":"with protobuf 6, all field with default value will not encode to serialized data, but when protobuf.js decode it, the generated object also not have such field, since we don't know which field will have default value,\r\nwe have to check every field for undefined and assign a default value to further process(display,calculate), it's somewhat annoying, it should be an parameter on decode function to guide protobuf.js to fill the default field value.\r\n\r\ntest with protobuf.js 6.0.1"},"comment":{"url":"https://api.github.com/repos/dcodeIO/protobuf.js/issues/comments/265412874","html_url":"https://github.com/dcodeIO/protobuf.js/issues/521#issuecomment-265412874","issue_url":"https://api.github.com/repos/dcodeIO/protobuf.js/issues/521","id":265412874,"user":{"login":"dcodeIO","id":1136893,"avatar_url":"https://avatars.githubusercontent.com/u/1136893?v=3","gravatar_id":"","url":"https://api.github.com/users/dcodeIO","html_url":"https://github.com/dcodeIO","followers_url":"https://api.github.com/users/dcodeIO/followers","following_url":"https://api.github.com/users/dcodeIO/following{/other_user}","gists_url":"https://api.github.com/users/dcodeIO/gists{/gist_id}","starred_url":"https://api.github.com/users/dcodeIO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcodeIO/subscriptions","organizations_url":"https://api.github.com/users/dcodeIO/orgs","repos_url":"https://api.github.com/users/dcodeIO/repos","events_url":"https://api.github.com/users/dcodeIO/events{/privacy}","received_events_url":"https://api.github.com/users/dcodeIO/received_events","type":"User","site_admin":false},"created_at":"2016-12-07T10:33:46Z","updated_at":"2016-12-07T10:33:46Z","body":"With protobuf.js 6, default values are on the respective prototype. Hence, when not present on the wire, accessing the field's value on a runtime message (received from decode, hence not a plain object) will still return the default value, while `Object#hasOwnProperty` called for the field will however return `false`.\r\n\r\nIt's possible that there are still bugs, though, so if you have an example of what is not working, please let me know!"}}
{"actor":{"display_login":"dcodeIO"}}