ts-proto 1.121.2 → 1.121.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.121.3](https://github.com/stephenh/ts-proto/compare/v1.121.2...v1.121.3) (2022-08-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Use underscore separator in snakeToCamel. ([#648](https://github.com/stephenh/ts-proto/issues/648)) ([b374910](https://github.com/stephenh/ts-proto/commit/b374910a8fb1d0efe6c5c5322f8788cc3cc1ca6c))
7
+
1
8
  ## [1.121.2](https://github.com/stephenh/ts-proto/compare/v1.121.1...v1.121.2) (2022-08-06)
2
9
 
3
10
 
package/README.markdown CHANGED
@@ -339,7 +339,15 @@ Generated code will be placed in the Gradle build directory.
339
339
 
340
340
  - With `--ts_proto_opt=lowerCaseServiceMethods=true`, the method names of service methods will be lowered/camel-case, i.e. `service.findFoo` instead of `service.FindFoo`.
341
341
 
342
- - With `--ts_proto_opt=snakeToCamel=false`, fields will be kept snake case. `snakeToCamel` can also be set as string with `--ts_proto_opt=snakeToCamel=keys,json`. `keys` will keep field names as camelCase and `json` will keep json field names as camelCase. Empty string will keep field names as snake_case.
342
+ - With `--ts_proto_opt=snakeToCamel=false`, fields will be kept snake case in both the message keys and the `toJSON` / `fromJSON` methods.
343
+
344
+ `snakeToCamel` can also be set as a `_`-delimited list of strings (comma is reserved as the flag delimited), i.e. `--ts_proto_opt=snakeToCamel=keys_json`, where including `keys` will make message keys be camel case and including `json` will make JSON keys be camel case.
345
+
346
+ Empty string, i.e. `snakeToCamel=`, will keep both messages keys and `JSON` keys as snake case (it is the same as `snakeToCamel=false`).
347
+
348
+ Note that to use the `json_name` attribute, you'll have to use the `json`.
349
+
350
+ The default behavior is `keys_json`, i.e. both will be camel cased, and `json_name` will be used if set.
343
351
 
344
352
  - With `--ts_proto_opt=outputEncodeMethods=false`, the `Message.encode` and `Message.decode` methods for working with protobuf-encoded/binary data will not be output.
345
353
 
package/build/options.js CHANGED
@@ -134,7 +134,7 @@ function optionsFromParameter(parameter) {
134
134
  options.snakeToCamel = ['keys', 'json'];
135
135
  }
136
136
  else if (typeof options.snakeToCamel === 'string') {
137
- options.snakeToCamel = [options.snakeToCamel];
137
+ options.snakeToCamel = options.snakeToCamel.split('_');
138
138
  }
139
139
  if (options.useJsonWireFormat) {
140
140
  if (!options.onlyTypes) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-proto",
3
- "version": "1.121.2",
3
+ "version": "1.121.3",
4
4
  "description": "",
5
5
  "main": "build/plugin.js",
6
6
  "repository": "github:stephenh/ts-proto",