grpc / grpc-dart

The Dart language implementation of gRPC.
https://pub.dev/packages/grpc
Apache License 2.0
860 stars 271 forks source link

Incorrect code generation for `google/protobuf/empty.proto` #560

Closed BorzdeG closed 2 years ago

BorzdeG commented 2 years ago

Some proto files do not generate dart code correctly

pubspec.lock :

grpc:
    dependency: "direct main"
    description:
      name: grpc
      url: "https://pub.dartlang.org"
    source: hosted
    version: "3.0.2"

Repro steps

  1. create proto file:
syntax = "proto3";

package demo;
option go_package = "./demo";

import "google/protobuf/empty.proto";

message DemoResponse {
    string name = 1;
}
service DemoService {
    rpc Say (google.protobuf.Empty) returns (DemoResponse);
}
  1. generate Dart code: protoc --proto_path=proto --dart_out=grpc:lib/src/generated demo.proto

  2. Added Dart dependencies: dart pub add protobuf http2 grpc

  3. Open demo.pbgrpc.dart file

Expected result: All imports are correct

Actual result:

image
mraleph commented 2 years ago

You currently need to generate empty.pb.dart yourself: https://github.com/google/protobuf.dart/issues/170