Skip to content
New issue

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

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

Already on GitHub? # to your account

Is PascalFromSnake the right conversion to be doing? #19

Closed
dmitshur opened this issue Jun 17, 2015 · 1 comment
Closed

Is PascalFromSnake the right conversion to be doing? #19

dmitshur opened this issue Jun 17, 2015 · 1 comment

Comments

@dmitshur
Copy link
Contributor

As far as I can tell, a protobuf name like uri becomes URI when generated. PascalFromSnake will convert uri into Uri, which is not compatible, causing populateQueryParameter to fail to do its job.

What's the right way to solve this mismatch?

Should PascalFromSnake be replaced with something that uses Go style casing that keeps acronym case matching (i.e. either uri or URI, never Uri)? That seems impossible to do in the general case, unless you hardcode a dictionary of all words that are considered acronyms. Although I wonder how the protobuf generator does this conversion.

The alternative is to have protobuf generator use pascal casing instead of Go style casing. This seems more friendly towards automatic code generation since it doesn't require hardcoded special cases (an acronym dictionary).

Any thoughts? How is this problem generally solved?

@dmitshur
Copy link
Contributor Author

As far as I can tell, a protobuf name like uri becomes URI when generated.

Sorry, it turns out that's not a general rule. It was happening in an example I saw because the name was overridden via a gogo customname field, i.e., [(gogoproto.customname) = "URI"].

I think this issue is invalid, so I'll close it.

ithinker1991 referenced this issue in tronprotocol/grpc-gateway Apr 26, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant