bufbuild/es: enable json_types=true in generated SDKs

Đang mở
#2,890 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

  • #2891 của @saefty — đã đóng, không merge

Đánh giá

Độ khó
1/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
typescript
Lĩnh vực
backend-api-design

Hướng nghiên cứu

Find the bufbuild/es plugin configuration that sets registry.opts for generated npm SDKs and read the surrounding versioning conventions. Add json_types=true as proposed, then verify the next generated SDK's .d.ts files include JSON message types while .js output stays unchanged. Pull request #2891 is already open for this issue.

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

Mô tả

The generated npm SDKs of buf.build/bufbuild/es are built with registry.opts: [import_extension=js]. protoc-gen-es v2 also has the option json_types=true, which adds a type for the JSON form of every message. Users of the generated SDKs cannot set plugin options, so they never get these types.

Use case: HTTP APIs that use the protobuf JSON mapping instead of gRPC. A client that only needs types for the JSON it receives has to derive them itself or run buf generate.

Effect: The .js output does not change. The .d.ts files gain the JSON types. toJson() without options returns the message's JSON type instead of JsonValue, so code that annotates the result as JsonValue may no longer compile.

Proposed change: add json_types=true to registry.opts of the next bufbuild/es version.

Ngôn ngữ chính
Dockerfile
Star
75
Fork
27
Merge trung bình
5 giờ 35 phút
Pull request đã merge (30 ngày)
52

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của bufbuild/plugins

Tất cả issue của bufbuild/plugins

Issue tương tự

Thêm issue về Backend & API Design

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.