-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor protobuf messages and files to establish a standard packaging scheme #131
Refactor protobuf messages and files to establish a standard packaging scheme #131
Conversation
Looking into the doc-generation error. |
797f96f
to
55e1df9
Compare
This commit updates the package name of `location.proto` from `frequenz.api.common.v1.location` to `frequenz.api.common.v1`. This sets package name of this proto file to its parent directory name, which seems to be a standard practice. Signed-off-by: Tiyash Basu <tiyash.basu@frequenz.com>
This commit refactors `pagination.proto` to move the `PaginationParams` and `PaginationInfo` messages to their own files, in a new directory `pagination`. This sets package name of this proto file to its parent directory name, which seems to be a standard practice. Signed-off-by: Tiyash Basu <tiyash.basu@frequenz.com>
This commit refactors the metrics proto files to be more modular and easier to maintain. The metrics proto files are now split into two files: `metric_sample.proto` and `bounds.proto`. The former contains the definition of the `MetricSample` message, while the latter contains the definition of the `Bounds` message. The files have also been moved into a new directory `metrics`, establishing their package name as `frequenz.api.common.v1.metrics`. Signed-off-by: Tiyash Basu <tiyash.basu@frequenz.com>
55e1df9
to
0208871
Compare
Fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I'm curios though, what's the benefit of the split in multiple files?
Nothing, from the perspective of rust or python. It is just cosmetic. |
Evidently, I was incorrect about python (correct about rust though). In python, the file name gets treated as the package name, so it creeps into the import paths as well. I still feel that splitting up files still adds more structure to the messages. So I would still go ahead with this, to keep things moving. If needed, we can of course look into re-organizing it before making the first major release. |
Personally I don't mind the extra package in Python, to be honest it already looks ugly in Python with the |
This change introduces the following packaging norm to the remaining protobuf files: the package for every protobuf file is it's path inside the protobuf directory. E.g., the package name for the message
PaginationInfo
isfrequenz.api.common.v1.pagination
, and the message lives in the filefrequenz/api/common/v1/paginaation/pagination_info.proto
.