Invalid Enum member names which contain the Enum name
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Tái hiện issue bằng định nghĩa test.proto và lệnh được ghi trong tài liệu protoc -I . --python_betterproto_out=lib test.proto. So sánh lib/hello/__init__.py được tạo ra với output mong đợi của 2.0.0b6, tập trung vào các member của enum Risk. Được xem là hoàn thành khi các tên enum như LOW_RISK và HIGH_RISK được giữ nguyên thay vì trở thành _.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
2.0.0b7 breaks enums with underscores in field names
Reproduction Steps
Test proto definition, in test.proto:
syntax = "proto3";
package hello;
// Greeting represents a message you can tell a user.
message Greeting {
Risk risk = 1;
}
enum Risk {
LOW_RISK = 0;
HIGH_RISK = 1;
}
Protoc compiler invocation:
$ protoc -I . --python_betterproto_out=lib test.proto
Expected Results
2.0.0b6 output (lib/hello/__init__.py):
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: test.proto
# plugin: python-betterproto
# This file has been @generated
from dataclasses import dataclass
import betterproto
class Risk(betterproto.Enum):
LOW_RISK = 0
HIGH_RISK = 1
@dataclass(eq=False, repr=False)
class Greeting(betterproto.Message):
"""Greeting represents a message you can tell a user."""
risk: "Risk" = betterproto.enum_field(1)
Actual Results
2.0.0b7 output (lib/hello/__init__.py):
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: test.proto
# plugin: python-betterproto
# This file has been @generated
from dataclasses import dataclass
import betterproto
class Risk(betterproto.Enum):
_ = 0
_ = 1
@dataclass(eq=False, repr=False)
class Greeting(betterproto.Message):
"""Greeting represents a message you can tell a user."""
risk: "Risk" = betterproto.enum_field(1)
System Information
- Protoc version: libprotoc 27.3
- Python version: Python 3.11.7
- Betterproto version:
Name: betterproto
Version: 2.0.0b7
Summary: A better Protobuf / gRPC generator & library
Home-page: https://github.com/danielgtaylor/python-betterproto
Author: Daniel G. Taylor
Author-email: [email protected]
License: MIT
Location: /Users/connor/Code/tests/test070/.venv/lib/python3.11/site-packages
Requires: grpclib, python-dateutil, typing-extensions
Required-by:
Checklist
- I have searched the issues for duplicates.
- I have shown the entire traceback, if possible.
- I have verified this issue occurs on the latest prelease of betterproto which can be installed using
pip install -U --pre betterproto, if possible.
- Ngôn ngữ chính
- Python
- Star
- 1.8k
- Fork
- 235
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọ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 danielgtaylor/python-betterproto
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
-
bug investigation needed
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
-
bug investigation needed
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
-
bug investigation needed
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
danielgtaylor/python-betterproto#676 · 3 bình luận ·
Tất cả issue của danielgtaylor/python-betterproto
Issue tương tự
-
[Resource]: LoreĐang mởresource-submission validation-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
hesreallyhim/awesome-claude-code#3234 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
openminion/openminion#376 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Type: ☹︎ Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
posit-dev/great-tables#1028 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
integration: apple_tv
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
home-assistant/core#188282 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A "since" range is worded as a career: "the past two seasons" says "regular season career (2025 on)"Đang mởP4: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
jeffknupp/association#538 ·