bufbuild / buf

The best way of working with Protocol Buffers.

Home Page:https://buf.build

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add linter that enforces that json_name values are lower_snake_case

flc1125 opened this issue · comments

message SubscribeResponse {
  string subscription_id = 1 [json_name = "subscription_id"]; // <-----
}

My requirement is that when generating PHP code via protobuf and using: serializeToJsonString directly,

if json_name is not defined, it will produce camel case. It looks like this: user_name -> userName.

Thanks for your request here. It's a fair issue, but we'll have to consider the implications. We are working on the ability to write custom lint plugins at the moment, and this may be a good candidate for a custom lint rule implemented outside of buf, given that there may not be a good consensus as to what style json_name values should be in. We'll keep this issue open as we work on custom lint plugins, and will keep you updated.

This is an excellent approach. Looking forward to the release of new features.