This repository was archived by the owner on Jun 9, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +0
-39
lines changed
src/betterproto2_compiler/plugin Expand file tree Collapse file tree 2 files changed +0
-39
lines changed Original file line number Diff line number Diff line change 118
118
)
119
119
120
120
121
- # TODO patch again to make field optional
122
- # def monkey_patch_oneof_index():
123
- # """
124
- # The compiler message types are written for proto2, but we read them as proto3.
125
- # For this to work in the case of the oneof_index fields, which depend on being able
126
- # to tell whether they were set, we have to treat them as oneof fields. This method
127
- # monkey patches the generated classes after the fact to force this behaviour.
128
- # """
129
- # object.__setattr__(
130
- # FieldDescriptorProto.__dataclass_fields__["oneof_index"].metadata[
131
- # "betterproto"
132
- # ],
133
- # "group",
134
- # "oneof_index",
135
- # )
136
- # object.__setattr__(
137
- # Field.__dataclass_fields__["oneof_index"].metadata["betterproto"],
138
- # "group",
139
- # "oneof_index",
140
- # )
141
-
142
-
143
121
def get_comment (
144
122
proto_file : "FileDescriptorProto" ,
145
123
path : list [int ],
Original file line number Diff line number Diff line change 5
5
from betterproto2 .lib .google .protobuf import (
6
6
DescriptorProto ,
7
7
EnumDescriptorProto ,
8
- FieldDescriptorProto ,
9
8
FileDescriptorProto ,
10
9
ServiceDescriptorProto ,
11
10
)
@@ -175,22 +174,6 @@ def generate_code(request: CodeGeneratorRequest) -> CodeGeneratorResponse:
175
174
return response
176
175
177
176
178
- def _make_one_of_field_compiler (
179
- output_package : OutputTemplate ,
180
- source_file : "FileDescriptorProto" ,
181
- parent : MessageCompiler ,
182
- proto_obj : "FieldDescriptorProto" ,
183
- path : list [int ],
184
- ) -> FieldCompiler :
185
- return OneOfFieldCompiler (
186
- source_file = source_file ,
187
- parent = parent ,
188
- proto_obj = proto_obj ,
189
- path = path ,
190
- typing_compiler = output_package .typing_compiler ,
191
- )
192
-
193
-
194
177
def read_protobuf_type (
195
178
item : DescriptorProto ,
196
179
path : list [int ],
You can’t perform that action at this time.
0 commit comments