Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default custom option value in google-protobuf runtime #181

Open
yaotusa opened this issue Dec 18, 2023 · 0 comments
Open

default custom option value in google-protobuf runtime #181

yaotusa opened this issue Dec 18, 2023 · 0 comments

Comments

@yaotusa
Copy link

yaotusa commented Dec 18, 2023

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant