protobuf.js icon indicating copy to clipboard operation
protobuf.js copied to clipboard

KeepCase should default to true

Open shahab96 opened this issue 1 year ago • 1 comments

protobuf.js version: latest

Keep case defaults to false. This results in the default being to violate protobuf contracts until explicitly told not to. It is not protobuf.js's job to conform to casing opinions, rather to comply with the proto files provided to it. If a non camel case item exists, it should be respected. Otherwise protobuf.js is simply violating a contract just because it's not camelCase.

I'm happy to make this change if the maintainers allow it.

Edit: Here's a reference to the default https://github.com/protobufjs/protobuf.js/blob/2f846fe09c1e4033bdfb63ea622a63dc7ae559db/src/parse.js#L5

shahab96 avatar Jan 19 '24 00:01 shahab96

I understand where you are coming from. Both decisions (either true or false as a default value for keepCase) has pros and cons. Using camelCase for proto messages in JavaScript is pretty much standard these days, even the official JSON spec suggests camelCase.

Changing the default will be a big breaking change and a lot of code will stop working, so I don't think we should do it.

alexander-fenster avatar Jan 23 '24 18:01 alexander-fenster