-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
Describe the bug
When protobuf messages define nested message types (like DataSource.FileOptions), the generated code imports and references them as flat names rather than as nested classes.
Why this is a problem
Breaks namespace organization
Causes naming conflicts when multiple messages have nested types with the same name
Requires extensive import rewrites
Dependencies
python version: sys.version_info(major=3, minor=11, micro=8, releaselevel='final', serial=0)
############# dependencies ##############
grpc: 1.62.3
pydantic: 2.10.6
########## Expand dependencies ##########
mypy-protobuf: 3.3.0
toml: 0.10.2
########## Format dependencies ##########
autoflake: Not Install
black: Not Install
isort: Not Install
Protobuf File Content
syntax = "proto3";
message DataSource {
message FileOptions {
string path = 1;
}
message BigQueryOptions {
string table = 1;
}
oneof options {
FileOptions file = 10;
BigQueryOptions bigquery = 11;
}
}
message SavedDataset {
DataSource.FileOptions file_storage = 1;
DataSource.BigQueryOptions bigquery_storage = 2;
}
CLI(if use plugin mode)
python -m grpc_tools.protoc \ -I. \ --protobuf-to-pydantic_out=. \ feast/core/DataSource.proto feast/core/SavedDataset.proto
Output content
from .DataSource_p2p import BigQueryOptions
class SavedDataset(BaseModel):
file_storage: FileOptions = Field(default_factory=FileOptions)
bigquery_storage: BigQueryOptions = Field(default_factory=BigQueryOptions)
Expected behavior
from .DataSource_p2p import DataSource
class SavedDataset(BaseModel):
file_storage: typing.Optional[DataSource.FileOptions] = Field(default=None)
bigquery_storage: typing.Optional[DataSource.BigQueryOptions] = Field(default=None)
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
No labels