Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linter that enforces that json_name values are lower_snake_case #2935

Closed
flc1125 opened this issue Apr 30, 2024 · 3 comments
Closed

Add linter that enforces that json_name values are lower_snake_case #2935

flc1125 opened this issue Apr 30, 2024 · 3 comments
Labels
Feature New feature or request

Comments

@flc1125
Copy link

flc1125 commented Apr 30, 2024

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.

@flc1125 flc1125 changed the title feature:[buf lint] You want to add validation that supports json name to be lowercase feature:[buf lint] Add validation that supports json_name to be lowercase Apr 30, 2024
@bufdev bufdev changed the title feature:[buf lint] Add validation that supports json_name to be lowercase Add linter that enforces that json_name values are lower_snake_case May 18, 2024
@bufdev
Copy link
Member

bufdev commented May 18, 2024

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.

@bufdev bufdev added the Feature New feature or request label May 18, 2024
@flc1125
Copy link
Author

flc1125 commented May 20, 2024

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

@bufdev
Copy link
Member

bufdev commented Jun 13, 2024

We're cleaning up our issues, and we're going to close this as a "duplicate" of #29 - we're actively working on #29, so I'd encourage you to watch that issue for updates!

@bufdev bufdev closed this as completed Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants