protocolbuffers / protocolbuffers/protobuf-javascript
default custom option value in google-protobuf runtime
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 471
- Forks
- 91
- Avg merge
- 3h 57m
- Merged PRs (30d)
- 2
Description
Due to our limited support resources, feature requests will generally not be accepted, except for those referring to build or tooling integration.
1、I declear one proto 3 file as follows
syntax = "proto3";
import "google/protobuf/descriptor.proto";
extend google.protobuf.MessageOptions {
optional string my_option = 51234;
}
message Ext {
option (my_option) = "Hello world!";
}
2、And then I compile it, and use js in google-protobuf runtime
import { Ext, myOption } from './ext_pb'
const ext = new Ext()
3、 And then, if I execute the following code
console.log(ext.getExtension(myOption))
I think it would output "Hello world!", but it ouput "undefined", why this happen;
4、If I execute the following code
ext.setExtension(myOption, 'se')
console.log(ext.getExtension(myOption))
It would output 'se' as expected;
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior with the shown proto3 declaration, generated ext_pb module, and google-protobuf runtime. Start at the getExtension and setExtension entry points, compare their handling of the declared option, and verify that reading the extension returns "Hello world!" before any setter call.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100