Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Protobuf字段名,其中包含单词“quot;Id";将其大写为“;ID";当生成.pb.swift模型时_Swift_Protocol Buffers_Protoc - Fatal编程技术网

Protobuf字段名,其中包含单词“quot;Id";将其大写为“;ID";当生成.pb.swift模型时

Protobuf字段名,其中包含单词“quot;Id";将其大写为“;ID";当生成.pb.swift模型时,swift,protocol-buffers,protoc,Swift,Protocol Buffers,Protoc,我正在尝试使用swift protobuf: $ protoc --version libprotoc 3.3.0 $ protoc-gen-swift --version protoc-gen-swift 0.9.904 我有Test.proto文件,我需要将其转换为Test.pb.swift: syntax = "proto2"; message Test { optional int64 TestId = 1 [default = 0]; } 为此,我正在使用: $ proto

我正在尝试使用swift protobuf:

$ protoc --version
libprotoc 3.3.0
$ protoc-gen-swift --version
protoc-gen-swift 0.9.904
我有
Test.proto
文件,我需要将其转换为
Test.pb.swift

syntax = "proto2";

message Test {
   optional int64 TestId = 1 [default = 0];
}
为此,我正在使用:

$ protoc --swift_opt=Visibility=Public  --swift_out=./ ./Test.proto
它生成的长.pb.swift文件:

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.
  ....
那么,为什么
TestId
转换为
TestId
,例如为什么
Id
大写为
Id

如何纠正或避免这种资本化行为?

年回购协议中给出了具体的答案

因此,据我所知,现在我需要将我所有的“id”或“id”用法重命名为“id”