Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions example/example_proto/demo/demo.proto
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,15 @@ message TestSameName1 {
}
Body body = 1;
}

// The issue refers to an ungenerated message in the map
message DemoResp {
map<int32, DemoState> demoState = 1;
int64 pramsArea = 2;
bool paramsSeason = 3;
}


message DemoState {
int64 paramsDID = 4;
}
12 changes: 11 additions & 1 deletion example/proto_3_20_pydanticv1/demo_gen_code.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is an automatically generated file, please do not change
# gen by protobuf_to_pydantic[v0.3.1.0](https://github.com/so1n/protobuf_to_pydantic)
# gen by protobuf_to_pydantic[v0.3.1.1](https://github.com/so1n/protobuf_to_pydantic)
# Protobuf Version: 3.20.3
# Pydantic Version: 1.10.7
import typing
Expand All @@ -25,6 +25,16 @@ class SubMessage(BaseModel):
field2: SubMessage = Field(default_factory=SubMessage)


class DemoState(BaseModel):
paramsDID: int = Field(default=0)


class DemoResp(BaseModel):
demoState: typing.Dict[int, DemoState] = Field(default_factory=dict)
pramsArea: int = Field(default=0)
paramsSeason: bool = Field(default=False)


class EmptyMessage(BaseModel):
pass

Expand Down
2 changes: 1 addition & 1 deletion example/proto_3_20_pydanticv1/demo_gen_code_by_p2p.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is an automatically generated file, please do not change
# gen by protobuf_to_pydantic[v0.3.1.0](https://github.com/so1n/protobuf_to_pydantic)
# gen by protobuf_to_pydantic[v0.3.1.1](https://github.com/so1n/protobuf_to_pydantic)
# Protobuf Version: 3.20.3
# Pydantic Version: 1.10.7
import typing
Expand Down
2 changes: 1 addition & 1 deletion example/proto_3_20_pydanticv1/demo_gen_code_by_pgv.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is an automatically generated file, please do not change
# gen by protobuf_to_pydantic[v0.3.1.0](https://github.com/so1n/protobuf_to_pydantic)
# gen by protobuf_to_pydantic[v0.3.1.1](https://github.com/so1n/protobuf_to_pydantic)
# Protobuf Version: 3.20.3
# Pydantic Version: 1.10.7
import typing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is an automatically generated file, please do not change
# gen by protobuf_to_pydantic[v0.3.1.0](https://github.com/so1n/protobuf_to_pydantic)
# gen by protobuf_to_pydantic[v0.3.1.1](https://github.com/so1n/protobuf_to_pydantic)
# Protobuf Version: 3.20.3
# Pydantic Version: 1.10.7
import typing
Expand Down Expand Up @@ -28,6 +28,16 @@ class SubMessage(BaseModel):
field2: SubMessage = Field(default_factory=SubMessage)


class DemoState(BaseModel):
paramsDID: int = Field(default=0)


class DemoResp(BaseModel):
demoState: typing.Dict[int, DemoState] = Field(default_factory=dict)
pramsArea: int = Field(default=0)
paramsSeason: bool = Field(default=False)


class EmptyMessage(BaseModel):
pass

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is an automatically generated file, please do not change
# gen by protobuf_to_pydantic[v0.3.1.0](https://github.com/so1n/protobuf_to_pydantic)
# gen by protobuf_to_pydantic[v0.3.1.1](https://github.com/so1n/protobuf_to_pydantic)
# Protobuf Version: 3.20.3
# Pydantic Version: 1.10.7
import typing
Expand Down Expand Up @@ -28,6 +28,16 @@ class SubMessage(BaseModel):
field2: SubMessage = Field(default_factory=SubMessage)


class DemoState(BaseModel):
paramsDID: int = Field(default=0)


class DemoResp(BaseModel):
demoState: typing.Dict[int, DemoState] = Field(default_factory=dict)
pramsArea: int = Field(default=0)
paramsSeason: bool = Field(default=False)


class EmptyMessage(BaseModel):
pass

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is an automatically generated file, please do not change
# gen by protobuf_to_pydantic[v0.3.1.0](https://github.com/so1n/protobuf_to_pydantic)
# gen by protobuf_to_pydantic[v0.3.1.1](https://github.com/so1n/protobuf_to_pydantic)
# Protobuf Version: 3.20.3
# Pydantic Version: 1.10.7
from enum import IntEnum
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is an automatically generated file, please do not change
# gen by protobuf_to_pydantic[v0.3.1.0](https://github.com/so1n/protobuf_to_pydantic)
# gen by protobuf_to_pydantic[v0.3.1.1](https://github.com/so1n/protobuf_to_pydantic)
# Protobuf Version: 3.20.3
# Pydantic Version: 1.10.7
import typing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is an automatically generated file, please do not change
# gen by protobuf_to_pydantic[v0.3.1.0](https://github.com/so1n/protobuf_to_pydantic)
# gen by protobuf_to_pydantic[v0.3.1.1](https://github.com/so1n/protobuf_to_pydantic)
# Protobuf Version: 3.20.3
# Pydantic Version: 1.10.7
import typing
Expand Down Expand Up @@ -57,8 +57,8 @@ class MapMessage(BaseModel):
test map message and bad message
"""

user_map: typing.Optional[typing.Dict[str, UserMessage]] = Field(default_factory=dict)
user_flag: typing.Optional[typing.Dict[str, bool]] = Field(default_factory=dict)
user_map: typing.Optional["typing.Dict[str, UserMessage]"] = Field(default_factory=dict)
user_flag: typing.Optional["typing.Dict[str, bool]"] = Field(default_factory=dict)


class RepeatedMessage(BaseModel):
Expand Down Expand Up @@ -93,8 +93,8 @@ class IncludeEnum(IntEnum):
one = 1
two = 2

user_list_map: typing.Optional[typing.Dict[str, RepeatedMessage]] = Field(default_factory=dict)
user_map: typing.Optional[typing.Dict[str, MapMessage]] = Field(default_factory=dict)
user_list_map: typing.Optional["typing.Dict[str, RepeatedMessage]"] = Field(default_factory=dict)
user_map: typing.Optional["typing.Dict[str, MapMessage]"] = Field(default_factory=dict)
user_pay: typing.Optional["NestedMessage.UserPayMessage"] = Field(
default_factory=lambda: NestedMessage.UserPayMessage()
)
Expand Down Expand Up @@ -128,7 +128,7 @@ class OptionalMessage(BaseModel):
age: typing.Optional[int] = Field(default=0)
item: typing.Optional[InvoiceItem] = Field(default_factory=InvoiceItem)
str_list: typing.Optional[typing.List[str]] = Field(default_factory=list)
int_map: typing.Optional[typing.Dict[str, int]] = Field(default_factory=dict)
int_map: typing.Optional["typing.Dict[str, int]"] = Field(default_factory=dict)
default_template_test: typing.Optional[float] = Field(default=1600000000.0)


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is an automatically generated file, please do not change
# gen by protobuf_to_pydantic[v0.3.1.0](https://github.com/so1n/protobuf_to_pydantic)
# gen by protobuf_to_pydantic[v0.3.1.1](https://github.com/so1n/protobuf_to_pydantic)
# Protobuf Version: 3.20.3
# Pydantic Version: 1.10.7
import typing
Expand Down Expand Up @@ -53,8 +53,8 @@ class MapMessage(BaseModel):
test map message and bad message
"""

user_map: typing.Dict[str, UserMessage] = Field(default_factory=dict)
user_flag: typing.Dict[str, bool] = Field(default_factory=dict)
user_map: "typing.Dict[str, UserMessage]" = Field(default_factory=dict)
user_flag: "typing.Dict[str, bool]" = Field(default_factory=dict)


class RepeatedMessage(BaseModel):
Expand Down Expand Up @@ -87,8 +87,8 @@ class IncludeEnum(IntEnum):
one = 1
two = 2

user_list_map: typing.Dict[str, RepeatedMessage] = Field(default_factory=dict)
user_map: typing.Dict[str, MapMessage] = Field(default_factory=dict)
user_list_map: "typing.Dict[str, RepeatedMessage]" = Field(default_factory=dict)
user_map: "typing.Dict[str, MapMessage]" = Field(default_factory=dict)
user_pay: "NestedMessage.UserPayMessage" = Field(default_factory=lambda: NestedMessage.UserPayMessage())
include_enum: "NestedMessage.IncludeEnum" = Field(default=0)
empty: None = Field()
Expand Down Expand Up @@ -120,7 +120,7 @@ class OptionalMessage(BaseModel):
age: typing.Optional[int] = Field(default=0)
item: typing.Optional[InvoiceItem] = Field(default_factory=InvoiceItem)
str_list: typing.List[str] = Field(default_factory=list)
int_map: typing.Dict[str, int] = Field(default_factory=dict)
int_map: "typing.Dict[str, int]" = Field(default_factory=dict)
default_template_test: float = Field(default=1600000000.0)


Expand Down Expand Up @@ -170,14 +170,28 @@ class TestSameName0(BaseModel):

class Body(BaseModel):
input_model: str = Field(default="")
input_info: typing.Dict[str, str] = Field(default_factory=dict)
input_info: "typing.Dict[str, str]" = Field(default_factory=dict)

body: "TestSameName0.Body" = Field(default_factory=lambda: TestSameName0.Body())


class TestSameName1(BaseModel):
class Body(BaseModel):
output_model: str = Field(default="")
output_info: typing.Dict[str, str] = Field(default_factory=dict)
output_info: "typing.Dict[str, str]" = Field(default_factory=dict)

body: "TestSameName1.Body" = Field(default_factory=lambda: TestSameName1.Body())


class DemoResp(BaseModel):
"""
The issue refers to an ungenerated message in the map
"""

demoState: "typing.Dict[int, DemoState]" = Field(default_factory=dict)
pramsArea: int = Field(default=0)
paramsSeason: bool = Field(default=False)


class DemoState(BaseModel):
paramsDID: int = Field(default=0)
Loading
Loading