Need info around options/configs for Google Proto Js compiler

39 views
Skip to first unread message

Usama Sulaiman

unread,
Apr 19, 2021, 1:41:24 AM4/19/21
to Protocol Buffers

Hi,

I wanted to understand what options/configs do we have while using Google Proto Js compiler for styling enums. I am facing a problem that all my enum value names get converted to uppercase after running through the compiler.

Right now our proto definition for a particular case looks like this

option java_package = "com.packageName.proto.device";
option java_outer_classname = "PlatformEntity";

/* Supported Platforms */
enum Platform { iOS = 1; Android = 2; Web = 3; Backend =4; }

-----------------------------------------------------------------------

The compiled js code looks something like this

var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();
goog.exportSymbol('proto.Platform', null, global);

/** * @enum {number} */
proto.Platform = { IOS: 1, ANDROID: 2, WEB: 3, BACKEND: 4 }; goog.object.extend(exports, proto);

As I understand, the style guide suggests enum value names to be defined with CAPITALS, but we don't want to do that as it will corrupt our existing data and/or reports.

Would appreciate if someone could point out a way to enforce the existing styling here during compilation.

Thanks

Reply all
Reply to author
Forward
0 new messages