Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Commit 3db9d1f

Browse files
committed
Fix builtin with annotations
1 parent 517c698 commit 3db9d1f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/betterproto2_compiler/plugin/models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,14 +441,15 @@ def annotations(self) -> list[str]:
441441
def annotation(self) -> str:
442442
py_type = self.py_type
443443

444+
if self.use_builtins:
445+
py_type = f"builtins.{py_type}"
446+
444447
# Add the pydantic annotation if needed
445448
if self.output_file.settings.pydantic_dataclasses:
446449
annotations = self.annotations
447450
if annotations:
448451
py_type = f"typing.Annotated[{py_type}, {', '.join(annotations)}]"
449452

450-
if self.use_builtins:
451-
py_type = f"builtins.{py_type}"
452453
if self.repeated:
453454
return f"list[{py_type}]"
454455
if self.optional:

0 commit comments

Comments
 (0)