Browse Source

Enable support for proto3 optionals (#1084)

Motivation:

proto3 added support for optional fields, this requires code generators 
to support it to avoid warnings/errors when it is enabled by default. Since
protoc-gen-grpc-swift doesn't codegen messages, enabling this is 
essentially a no-op.

See also: https://github.com/protocolbuffers/protobuf/blob/master/docs/implementing_proto3_presence.md

Modifications:

- Add `.proto3Optional` to the supported features of the codegen.

Result:

Users can use optionals without warnings/errors.
azatZul 5 years ago
parent
commit
93ff1e1353
1 changed files with 4 additions and 1 deletions
  1. 4 1
      Sources/protoc-gen-grpc-swift/main.swift

+ 4 - 1
Sources/protoc-gen-grpc-swift/main.swift

@@ -104,7 +104,10 @@ func uniqueOutputFileName(
 
 func main() throws {
   // initialize responses
-  var response = Google_Protobuf_Compiler_CodeGeneratorResponse()
+  var response = Google_Protobuf_Compiler_CodeGeneratorResponse(
+    files: [],
+    supportedFeatures: [.proto3Optional]
+  )
 
   // read plugin input
   let rawRequest = try Stdin.readall()