Skip to content

Commit 9afb8a2

Browse files
committed
proto3: skip defaults
Defaults are not supported in proto3, and therefore should not be appended to a `.proto` file when using `-t proto3` flag for `pbjs`.
1 parent 952c7d1 commit 9afb8a2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cli/targets/proto.js

+2
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ function buildFieldOptions(field) {
238238
return;
239239
break;
240240
case "default":
241+
if (syntax === 3)
242+
return;
241243
// skip default (resolved) default values
242244
if (field.long && !util.longNeq(field.defaultValue, types.defaults[field.type]) || !field.long && field.defaultValue === types.defaults[field.type])
243245
return;

0 commit comments

Comments
 (0)