Behavioral differences during jsonification of field names during upgrade

2 views
Skip to first unread message

David Greenberg

unread,
Jan 8, 2019, 1:28:19 PM1/8/19
to ScalaPB
Hello, I recently switched from using ScalaPB through SBT to ScalaPB through Bazel. After this change, I am seeing inconsistencies between the field descriptor and the protobuf. Below I've pasted an example of this. Does anyone know if this was due to a bugfix, rollback to an earlier version, or different argument that I'm passing to scalapb? I've tried to figure that out to no avail.

Thank you!

Example:

Field name in the protobuf:        foo30m
Generated Scala field name:       foo30M
Companion’s JSON-ified name:   foo30m

Metadata printout from the Companion’s Field Descriptor:
name: "foo30m"
number: 4
label: LABEL_REPEATED
type: TYPE_DOUBLE
json_name: "foo30m"

Nadav Samet

unread,
Jan 8, 2019, 4:46:24 PM1/8/19
to David Greenberg, ScalaPB
Hi David, can you clarify what is the inconsistency you are seeing?

--
You received this message because you are subscribed to the Google Groups "ScalaPB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalapb+u...@googlegroups.com.
To post to this group, send email to sca...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalapb/97500a25-25f8-4f94-9591-0d792b665b91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
-Nadav

David Greenberg

unread,
Jan 8, 2019, 6:07:43 PM1/8/19
to Nadav Samet, ScalaPB
Sure, it’s that the generated scaled code has a capital M, but the json_name in the descriptor has a lower case m.

Thank you!

Nadav Samet

unread,
Jan 8, 2019, 6:22:51 PM1/8/19
to David Greenberg, ScalaPB
The json_name field is generated by protoc, the Scala field name is chosen by ScalaPB - so they may be a little different in some cases. The difference between the Scala name and json_name has existed for long time and hasn't changed in recent versions. Is that causing any problems? Do you need the Scala field name from the descriptor?
--
-Nadav

David Greenberg

unread,
Jan 9, 2019, 10:06:53 AM1/9/19
to Nadav Samet, ScalaPB
Yes, is there a way to use the descriptor to get the scalar field name? We would like to do that to automate some integrations.

Nadav Samet

unread,
Jan 9, 2019, 10:13:23 AM1/9/19
to David Greenberg, ScalaPB
Not currently, can you file a feature request on GitHub?
Reply all
Reply to author
Forward
0 new messages