2

I'm trying to use swift-protobuf:

$ protoc --version
libprotoc 3.3.0
$ protoc-gen-swift --version
protoc-gen-swift 0.9.904

I have Test.proto file, which I need to convert to Test.pb.swift:

syntax = "proto2";

message Test {
   optional int64 TestId = 1 [default = 0];
}

To do this I'm using:

$ protoc --swift_opt=Visibility=Public  --swift_out=./ ./Test.proto

It generate's long .pb.swift file:

public struct Test: SwiftProtobuf.Message {
  public static let protoMessageName: String = "Test"

  public var testID: Int64 {
    get {return _testID ?? 0}
    set {_testID = newValue}
  }
  /// Returns true if `testID` has been explicitly set.
  ....

So, why TestId converted to testID, e.g. why Id capitalized to ID? How to fix or avoid this capitalization behavior?

romanilchyshyn
  • 392
  • 3
  • 15

1 Answers1

0

Particular answer was founded in apple/swift-protobuf repo in #491 Add "id" to the list of uppercase names.

So as I understand, now I need rename all my 'id' or 'Id' usages to "ID".

romanilchyshyn
  • 392
  • 3
  • 15