microsoft / microsoft/typespec
[protobuf] Handle collisions in emitted Protobuf namespaces
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
Currently, we don't check for name collisions in Protobuf packages, and in some cases, we synthesize names from contextual information. For example, we can create a message for the following operation:
```tsp
op Foo(@field(1) a: int32): void;
```
by representing it with the following Protobuf message:
```proto3
message FooInput {
int32 a = 1;
}
```
This is a nice ergonomic feature, but we aren't currently ensuring that some message named `FooInput` isn't otherwise declared. It should be an error if so.
- [ ] Ensure that the names of messages, services, and enums do not collide within the package.
- [ ] Ensure that the keys of enums also do not collide (enums in Protobuf have C++ scoping).
Contributor guide
Assessment
This issue has not been assessed yet.