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

change snake_case to camelCase fields name #89

Closed
wants to merge 1 commit into from

Conversation

jbpin
Copy link

@jbpin jbpin commented Sep 24, 2021

As discuss in the #78 issue, protocol buffer use snake_case for their field name, however the use of camelCase is more appropriate in JS/TS and more generally in generated code.

Copy link
Owner

@thesayyn thesayyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey. thank you for the initial work.

There seems to be some failing tests

@@ -1933,6 +1933,15 @@ function createMessage(
pbIdentifier
) {
const members = [];
messageDescriptor.field = messageDescriptor.field.map(f => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO - this shouldn't be the default behavior, but rather an parameter to the generator to enable the behavior of camelCasing.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also agree with that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think snake_case should be possible through param but default behavior must be camelCase. I can't see any styleguide/naming convention in Typescript that publicise snake_case as variable naming. Here is the one from Google where gRPC was born https://google.github.io/styleguide/tsguide.html

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn’t this be an opinion/preference that we enforce on users? (which I don’t like tbh).
I would argue that default behavior should be camelCase. I strongly believe that we should use whatever is there (current behavior) and only change it if an option such as --ts_opt=casing=camel is present.

@jbpin
Copy link
Author

jbpin commented Oct 5, 2021 via email

@SilverSheep SilverSheep mentioned this pull request Oct 6, 2021
@jbpin
Copy link
Author

jbpin commented Nov 4, 2021

Hi @thesayyn, can you help us make this go ahead ? Some test are failing due to case changes.
Can we find a plan and release these ?

@thesayyn
Copy link
Owner

Hey. i will take a look at this.

@cprovatas
Copy link

Looks like there are two pull requests open doing the same thing, which seems to suggest there is a strong desire to have camel case support. Is there a path forward on releasing this? I'd be unfortunate for users to have to make more forks just because we are not merging any PRs.

@thesayyn
Copy link
Owner

thesayyn commented Jan 2, 2022

I'd be unfortunate for users to have to make more forks just because we are not merging any PRs.

It is not that I am not willing to merge these PRs. As you can see that they are failing the existing tests yet they lack tests for this new behavior.

Unfortunately, I don’t have time to pick up every issue and fix it myself. hence I would really appreciate a proper PR (with tests) introducing this new behavior.

@thesayyn
Copy link
Owner

thesayyn commented Jan 2, 2022

closing this in favor of #98

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants