danielgtaylor / danielgtaylor/python-betterproto
Services with same package gets its comment overwritten
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Description
Say you have two files `service1.proto` and `service2.proto` with same package assigned:
service1.proto:
```protobuf
syntax = "proto3";
package service;
/* Service1 */
service Service1 {}
```
service2.proto:
```protobuf
syntax = "proto3";
package service;
/* Service2 */
service Service2 {}
```
Compiling these together with the command `python3 -m grpc_tools.protoc -I . --python_betterproto_out=./ service1.proto service2.proto` results in this:
service/__init__.py:
```py
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: service1.proto, service2.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import Dict
import betterproto
from betterproto.grpc.grpclib_server import ServiceBase
import grpclib
class Service1Stub(betterproto.ServiceStub):
"""Service1"""
class Service2Stub(betterproto.ServiceStub):
"""Service1"""
class Service1Base(ServiceBase):
"""Service1"""
def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
return {}
class Service2Base(ServiceBase):
"""Service1"""
def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
return {}
```
As you can see the comment for Service2 got overwritten.
I have reproduced this with current master branch, which I believe is version 2.0.0b2 with commit hash 6c1c41e9ccf7d020641e87f82e6419c3393a3841 .
Contributor guide
Assessment
This issue has not been assessed yet.