danielgtaylor / danielgtaylor/python-betterproto

Missing betterproto_lib_google_protobuf import if only used as rpc call parameter.

Đang mở
#409 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
compiler-bug
Ngôn ngữ chính
Python
Star
1.8k
Fork
234
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I'm using 2.0.0b5.

The following file results in broken python:

```proto
syntax = "proto3";

package experiment;

import "google/protobuf/empty.proto";

message Reply {
bool happy = 1;
}

service Testcase {
rpc call(google.protobuf.Empty) returns (Reply);
}
```

Specifically, the import `import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf` is missing from the output file.

When any `google.protobuf` imported field is used anywhere else, it does work correctly, for example, the following files all work:

```proto
syntax = "proto3";

package experiment;

import "google/protobuf/empty.proto";

message Reply {
bool happy = 1;
}

service Testcase {
rpc call(Reply) returns (google.protobuf.Empty);
}
```

```proto
syntax = "proto3";

package experiment;

import "google/protobuf/empty.proto";

message Reply {
bool happy = 1;
google.protobuf.Empty e = 2;
}

service Testcase {
rpc call(google.protobuf.Empty) returns (Reply);
}

```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Tái hiện vấn đề với đầu vào .proto được cung cấp và kiểm tra tệp đầu ra Python đã tạo. So sánh import dependency bị thiếu khi Empty chỉ được sử dụng làm tham số RPC với các trường hợp return và field hoạt động đúng; hoàn tất khi module được tạo bao gồm import bắt buộc và vẫn là Python hợp lệ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
tooling
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.