-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Use jsonName even with snakeToCamel=false. (#653)
Previously we only checked jsonName if snakeToCamel=json was enabled, b/c protobuf _always_ set jsonName to the camelized key name OR the jsonName attribute value. Because of this, we couldn't do logic like "if jsonName is explicitly set, use that, otherwise keep the field name as-is". Now we guess about whether jsonName is explicitly set by doing our own snake-field-name -> camel-json-name, and if our camel-json-name matches jsonName, then we assume the user has _not_ set jsonName, and we should keep using snake-field-name. But if those two values, camel-json-name and jsonName, are different, then the user has probably manually set jsonName in the proto file, and we'll use that instead. Fixes #635
- Loading branch information
Showing
3 changed files
with
38 additions
and
19 deletions.
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
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