Why does protoc convert properties name with 'Url' suffix to 'URL' when converting Objective-C?

20 views
Skip to first unread message

Cedric Diggory

unread,
Nov 9, 2021, 9:28:41 PM11/9/21
to Protocol Buffers

eg

message User { string logoUrl } @interface User @property logoURL; @end

I see that you have a kUpperSegmentsList in src/google/protobuf/compiler/objectivec/objectivec_helpers.cc. What is the use of this? It causes the url in the property name to be converted to all-caps.

thom...@google.com

unread,
Nov 10, 2021, 8:39:07 AM11/10/21
to Protocol Buffers
The protos style guide for fields: https://developers.google.com/protocol-buffers/docs/style#message_and_field_names

> Use underscore_separated_names for field names (including oneof field and extension names) – for example, song_name

To make the generated ObjC code a better fit for ObjC conventions, it attempts break things apart into the segments and apply Apple's naming guidelines when building the names.  Those include turning some acronym into allcaps.
Reply all
Reply to author
Forward
0 new messages