microsoft / microsoft/typespec

[protobuf] Handle collisions in emitted Protobuf namespaces

Open
#1,857 0 comments 0 reactions 1 assignee Claimed by @witemple-msft View on GitHub
emitter:protobuf feature triaged:core
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.