-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
protoc-gen-openapiv2: Use the canonical camelCase converter for protobuf #2599
Merged
johanbrandhorst
merged 2 commits into
grpc-ecosystem:master
from
oyvindwe:openapiv2-camel-case-fix
Mar 21, 2022
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# Case conversion | ||
|
||
This package contains a single function, copied from the | ||
`github.com/golang/protobuf/protoc-gen-go/generator` package. That | ||
modules LICENSE is referenced in its entirety in this package. | ||
This package contains two functions: | ||
- `Camel` copied from the `github.com/golang/protobuf/protoc-gen-go/generator` package. | ||
- `JSONCamelCase` copied from the `github.com/protocolbuffers/protobuf-go/internal/strs` package. | ||
|
||
Both these modules are licensed by The Go Authors, as reflected in this package's [LICENSE.md]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, do we still need the old function? We should probably always use the new one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the old one - that was coded inline in
template.go
.The
Camel
method looks more likeGoCamel
here though: https://github.com/protocolbuffers/protobuf-go/blob/3992ea83a23c00882339f33511074d251e19822c/internal/strs/strings.go#L28-L32There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect their logic to be roughly the same, though it might be worth using the new one anyway. We should probably always be consistent with what APIv2 uses (the new repo).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I follow you here. Do you mean that
Camel
should be replaced withGoCamelCase
? That method seems to now only be called fromprotoc-gen-grpc-gateway
, which I'm not familiar with (we use ESP).What do you refer to with "APIv2 uses (the new repo)"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to make any changes here, but there may be a subtle bug hidden somewhere here that will eventually rear its head. By APIv2 I mean the Go protobuf stack in google.golang.org/protobuf. That's the "new" stack. See https://blog.golang.org/protobuf-apiv2 for more information. The grpc-gateway v2 is built on APIv2.