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

A message type's toObject function includes extra underscore-prefixed fields when the oneofs option is set #2037

Open
murgatroid99 opened this issue Oct 28, 2024 · 0 comments

Comments

@murgatroid99
Copy link
Contributor

protobuf.js version: 7.4.0

Reproduction example:

Proto message:

syntax = "proto3";

message Test {
  optional string field = 1;
}

Code (node.js):

const protobufjs = require('protobufjs');
const root = protobufjs.loadSync('./test.proto');
console.log(root.Test.toObject({field: 'hello'}, {oneofs: true}));

Expected output:

{field: 'hello'}

Actual output:

{ field: 'hello', _field: 'field' }
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