betterproto2-compiler 0.2.0__py3-none-any.whl → 0.2.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -227,14 +227,21 @@ def read_protobuf_type(
227
227
  )
228
228
  )
229
229
 
230
- for index, oneof in enumerate(item.oneof_decl):
231
- message_data.oneofs.append(
232
- OneofCompiler(
233
- source_file=source_file,
234
- path=path + [8, index],
235
- proto_obj=oneof,
230
+ # Synthetic oneofs are generated for optional fields. We should not generate code or documentation for them.
231
+ is_synthetic_oneof = [True for _ in item.oneof_decl]
232
+ for field in item.field:
233
+ if field.oneof_index is not None and not field.proto3_optional:
234
+ is_synthetic_oneof[field.oneof_index] = False
235
+
236
+ for index, (oneof, is_synthetic) in enumerate(zip(item.oneof_decl, is_synthetic_oneof)):
237
+ if not is_synthetic:
238
+ message_data.oneofs.append(
239
+ OneofCompiler(
240
+ source_file=source_file,
241
+ path=path + [8, index],
242
+ proto_obj=oneof,
243
+ )
236
244
  )
237
- )
238
245
 
239
246
  elif isinstance(item, EnumDescriptorProto):
240
247
  # Enum
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: betterproto2_compiler
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Compiler for betterproto2
5
5
  License: MIT
6
6
  Keywords: protobuf,gRPC,compiler
@@ -18,15 +18,15 @@ betterproto2_compiler/plugin/compiler.py,sha256=3sPbCtdzjAGftVvoGe5dvxE8uTzJ78hA
18
18
  betterproto2_compiler/plugin/main.py,sha256=gI2fSWc9U-fn6MOlkLg7iResr2YsXbdOge6SzNWxBAo,1302
19
19
  betterproto2_compiler/plugin/models.py,sha256=TNe96ANhRHRgz3GqGqUXmtSskaRM_T_JDrqW0nCjpBA,21755
20
20
  betterproto2_compiler/plugin/module_validation.py,sha256=JnP8dSN83eJJVDP_UPJsHzq7E7Md3lah0PnKXDbFW5Q,4808
21
- betterproto2_compiler/plugin/parser.py,sha256=tBw9eq8KZc5GWSVo3t3P88YiTBgL4Byc8cJnIP1K6kY,9958
21
+ betterproto2_compiler/plugin/parser.py,sha256=9PT8ArcGwnCviIYo1j_dsfPcdroaSVWC0OfLNzI66hU,10410
22
22
  betterproto2_compiler/plugin/plugin.bat,sha256=lfLT1WguAXqyerLLsRL6BfHA0RqUE6QG79v-1BYVSpI,48
23
23
  betterproto2_compiler/plugin/typing_compiler.py,sha256=IK6m4ggHXK7HL98Ed_WjvQ_yeWfIpf_fIBZ9SA8UcyM,4873
24
24
  betterproto2_compiler/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  betterproto2_compiler/settings.py,sha256=d7XTRMywahR9PcOgaycPXLkHgJMSYDffuSO874yyrh0,182
26
26
  betterproto2_compiler/templates/header.py.j2,sha256=wYBR4yer77dTGM9e1RijuID-mI4GHrmk66OjdVvmBxc,1734
27
27
  betterproto2_compiler/templates/template.py.j2,sha256=theRmdVVan3dtVuHLlScuirRRLv6ePb15Rr9e_fHaWU,9238
28
- betterproto2_compiler-0.2.0.dist-info/LICENSE.md,sha256=Pgl2pReU-2yw2miGeQ55UFlyzqAZ_EpYVyZ2nWjwRv4,1121
29
- betterproto2_compiler-0.2.0.dist-info/METADATA,sha256=ct3SrwUF43Ye01wvXDBUPAjlVgYmVC6YL24OXr8d-fE,1099
30
- betterproto2_compiler-0.2.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
31
- betterproto2_compiler-0.2.0.dist-info/entry_points.txt,sha256=re3Qg8lLljbVobeeKH2f1FVQZ114wfZkGv3zCZTD8Ok,84
32
- betterproto2_compiler-0.2.0.dist-info/RECORD,,
28
+ betterproto2_compiler-0.2.1.dist-info/LICENSE.md,sha256=Pgl2pReU-2yw2miGeQ55UFlyzqAZ_EpYVyZ2nWjwRv4,1121
29
+ betterproto2_compiler-0.2.1.dist-info/METADATA,sha256=AdzKJ5vZAfH65dlC69ota1baRkikMYdXk4r1-qsauM8,1099
30
+ betterproto2_compiler-0.2.1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
31
+ betterproto2_compiler-0.2.1.dist-info/entry_points.txt,sha256=re3Qg8lLljbVobeeKH2f1FVQZ114wfZkGv3zCZTD8Ok,84
32
+ betterproto2_compiler-0.2.1.dist-info/RECORD,,