betterproto2-compiler 0.2.0__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/PKG-INFO +1 -1
  2. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/pyproject.toml +1 -1
  3. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/plugin/parser.py +14 -7
  4. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/LICENSE.md +0 -0
  5. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/README.md +0 -0
  6. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/__init__.py +0 -0
  7. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/casing.py +0 -0
  8. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/compile/__init__.py +0 -0
  9. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/compile/importing.py +0 -0
  10. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/compile/naming.py +0 -0
  11. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/known_types/__init__.py +0 -0
  12. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/known_types/any.py +0 -0
  13. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/known_types/duration.py +0 -0
  14. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/known_types/timestamp.py +0 -0
  15. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/lib/__init__.py +0 -0
  16. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/lib/google/__init__.py +0 -0
  17. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/lib/google/protobuf/__init__.py +0 -0
  18. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/lib/google/protobuf/compiler/__init__.py +0 -0
  19. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/lib/message_pool.py +0 -0
  20. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/plugin/__init__.py +0 -0
  21. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/plugin/__main__.py +0 -0
  22. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/plugin/compiler.py +0 -0
  23. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/plugin/main.py +0 -0
  24. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/plugin/models.py +0 -0
  25. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/plugin/module_validation.py +0 -0
  26. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/plugin/plugin.bat +0 -0
  27. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/plugin/typing_compiler.py +0 -0
  28. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/py.typed +0 -0
  29. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/settings.py +0 -0
  30. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/templates/header.py.j2 +0 -0
  31. {betterproto2_compiler-0.2.0 → betterproto2_compiler-0.2.1}/src/betterproto2_compiler/templates/template.py.j2 +0 -0
@@ -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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "betterproto2_compiler"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  description = "Compiler for betterproto2"
5
5
  authors = ["Adrien Vannson <adrien.vannson@protonmail.com>", "Daniel G. Taylor <danielgtaylor@gmail.com>"]
6
6
  readme = "README.md"
@@ -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