You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For certain protobufs, this plugin generates a default and a default_factory in Pydantic which causes an error.
To Reproduce
Steps to reproduce the behavior:
syntax = "proto3";
message A {
optional string a = 2;
repeated string b = 3;
}
Output:
# This is an automatically generated file, please do not change
# gen by protobuf_to_pydantic[v0.2.0.1](https://github.com/so1n/protobuf_to_pydantic)
# Protobuf Version: 4.24.3
# Pydantic Version: 1.10.12
from google.protobuf.message import Message # type: ignore
from pydantic import BaseModel
from pydantic import Field
import typing
class A(BaseModel):
a: typing.Optional[str] = Field(default="")
b: typing.Optional[typing.List[str]] = Field(default_factory=list, default=None)
Expected behavior
It should only generate the default factory list for repeated and not default=None.
The text was updated successfully, but these errors were encountered:
Describe the bug
Follow up on #22
For certain protobufs, this plugin generates a default and a default_factory in Pydantic which causes an error.
To Reproduce
Steps to reproduce the behavior:
Output:
Expected behavior
It should only generate the default factory list for
repeated
and notdefault=None
.The text was updated successfully, but these errors were encountered: