[Javascript] Incorrectly generated import paths when using `google/api` or `google/type`
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- grpc, javascript, typescript
- Lĩnh vực
- tooling
Hướng nghiên cứu
Bắt đầu với các import được tạo trong annotations_pb.js và lệnh grpc_tools_node_protoc được nêu trong issue, sau đó so sánh cách các thư mục gốc include -I ảnh hưởng đến các đường dẫn google/api và google/type. Công việc được xem là hoàn tất khi các import JavaScript được tạo có thể được phân giải chính xác, bao gồm cả các import bắc cầu như google/api/http_pb.js, mà không cần sao chép thủ công các tệp được tạo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
/cc @zchee
What version of protobuf and what language are you using?
Version: v3.6.0
Language: Javascript
What operating system (Linux, Windows, ...) and version?
Docker Image: node:9
What runtime / compiler are you using (e.g., python version or gcc version)
What did you do?
Steps to reproduce the behavior:
When using imports for google/api/.. or google/type/... the imports generated for javascript resolve to incorrect paths
Example:
import "google/api/annotations.proto";
import "google/type/date.proto";
What did you expect to see
Correctly resolved import paths
What did you see instead?
Wrongly resolved import paths:
generated output (these directories don't exist):
var google_api_annotations_pb = require('../../../../../../google/api/annotations_pb.js');
var google_type_date_pb = require('../../../../../../google/type/date_pb.js');
We resolved these imports by generating these files ourselves (from https://github.com/googleapis/googleapis repository) and copying them to the correct folder but inside of annotations_pb.js another incorrect import is generated so it seems that this problem is carrying through to any imports down the road:
// inside of annotations_pb.js
var google_api_http_pb = require('../../../../../../google/api/http_pb.js');
We wondered how we could resolve this? Generating the files ourselves and copying them is totally ok but the wrongly generated imports inside these files are an issue we can not resolve on our end unfortunately, so any help is appreciated.
Anything else we should know about your project / environment
We use grpc_tools_node_protoc and grpc_tools_node_protoc_ts plugins to generate typescript and grpc code.
Command we execute:
# Variables:
GRPC_GATEWAY_REPO=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis
GOOGLE_API_REPO=github.com/googleapis/googleapis
VENDOR_DIR=vendor
PROTOC_OPTION=-I. -I$(VENDOR_DIR) -I$(VENDOR_DIR)/$(GRPC_GATEWAY_REPO) -I$(VENDOR_DIR)/$(GOOGLE_API_REPO)
TYPESCRIPT_OUTPUT=gen/typescript
# Command:
grpc_tools_node_protoc $(PROTOC_OPTION) --js_out=import_style=commonjs,binary:$(TYPESCRIPT_OUTPUT) --grpc_out=$(TYPESCRIPT_OUTPUT) --plugin=protoc-gen-grpc=$(shell which grpc_tools_node_protoc_plugin)
# followed by this command for typescript generation:
protoc $(PROTOC_OPTION) --plugin=protoc-gen-ts=`which protoc-gen-ts` --ts_out=$(TYPESCRIPT_OUTPUT)
- Ngôn ngữ chính
- JavaScript
- Star
- 471
- Fork
- 91
- Merge trung bình
- 1 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 6
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của protocolbuffers/protobuf-javascript
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
protocolbuffers/protobuf-javascript#248 · 1 bình luận · 13 reaction ·
-
question
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
protocolbuffers/protobuf-javascript#222 · 9 bình luận ·
-
Why map.js sort keys?Đang mởenhancement port-fix triaged
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
protocolbuffers/protobuf-javascript#185 · 1 bình luận ·
-
enhancement port-fix triaged
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
protocolbuffers/protobuf-javascript#182 · 3 bình luận · 1 reaction ·
Tất cả issue của protocolbuffers/protobuf-javascript
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[quality] useFocusTrap's Shift+Tab wrap and non-Tab/non-Escape key arms are never driven end to endCó thể đã có người làm @hivecommons-hive đã nhận hôm nay. Đang mởagent/quality hive/covered-by-pr hive/hosted-available-lke648397-260827-5n31 quality testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[aw] Upgrade availableĐang mởagentic-workflows
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
githubnext/gh-aw-workshop#4220 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
JuliusBrussee/caveman#1189 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
priority:low ready-for-dev
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
OpenHands/extensions#738 ·
Maintainer thường phản hồi trong vòng 1 ngày