From 9afb8a2ff27c1e0a999d7331f3f65f568f5cced5 Mon Sep 17 00:00:00 2001 From: stelcheck Date: Fri, 1 Sep 2017 11:31:11 +0900 Subject: [PATCH] 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`. --- cli/targets/proto.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cli/targets/proto.js b/cli/targets/proto.js index f1500ac34..c6e08179f 100644 --- a/cli/targets/proto.js +++ b/cli/targets/proto.js @@ -238,6 +238,8 @@ function buildFieldOptions(field) { return; break; case "default": + if (syntax === 3) + return; // skip default (resolved) default values if (field.long && !util.longNeq(field.defaultValue, types.defaults[field.type]) || !field.long && field.defaultValue === types.defaults[field.type]) return;