protocolbuffers / protocolbuffers/protobuf-javascript

[JS] Getter function for singular message fields

Open
#81 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement javascript P3 port-fix triaged
Dominant language
JavaScript
Stars
471
Forks
91
Avg merge
3h 57m
Merged PRs (30d)
2

Description

Getter function for singular message fields in javascript returns "undefined" when the field is not set. This is not consistent with the behavior of getter function for such fields in all other languages.

This is very inconvenient and is a source of bugs because programmer has always check for undefined values for nested messages (imagine multi levels of nested submessages). It can be fixed by introducing new getter function like msg.GetFooOrDefault().

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by locating the JavaScript implementation or generator for singular message-field getters, then compare its unset-field behavior with the other language implementations. Done means the proposed getter behavior is defined and covered by tests, including nested unset messages.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.