diff --git a/src/betterproto2_compiler/plugin/models.py b/src/betterproto2_compiler/plugin/models.py index 66a47d41..52b69d54 100644 --- a/src/betterproto2_compiler/plugin/models.py +++ b/src/betterproto2_compiler/plugin/models.py @@ -441,14 +441,15 @@ def annotations(self) -> list[str]: def annotation(self) -> str: py_type = self.py_type + if self.use_builtins: + py_type = f"builtins.{py_type}" + # Add the pydantic annotation if needed if self.output_file.settings.pydantic_dataclasses: annotations = self.annotations if annotations: py_type = f"typing.Annotated[{py_type}, {', '.join(annotations)}]" - if self.use_builtins: - py_type = f"builtins.{py_type}" if self.repeated: return f"list[{py_type}]" if self.optional: diff --git a/tests/inputs/encoding_decoding/encoding_decoding.proto b/tests/inputs/encoding_decoding/encoding_decoding.proto new file mode 100644 index 00000000..2cf8e391 --- /dev/null +++ b/tests/inputs/encoding_decoding/encoding_decoding.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package encoding_decoding; + +message Overflow32 { + uint32 uint = 1; + int32 int = 2; + sint32 sint = 3; +} + +message Overflow64 { + uint64 uint = 1; + int64 int = 2; + sint64 sint = 3; +} diff --git a/tests/inputs/manual_validation/manual_validation.proto b/tests/inputs/manual_validation/manual_validation.proto new file mode 100644 index 00000000..88603113 --- /dev/null +++ b/tests/inputs/manual_validation/manual_validation.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +package manual_validation; + +message Msg { + uint32 x = 1; +}