-
Notifications
You must be signed in to change notification settings - Fork 75
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
Feature request: Allow prefixing generated type names #1017
Comments
This would be quite useful to have. In our case we're generating wrapper classes that provide an API similar to v1 and protobuf-js, and having the base types prefixed would be handy. |
Prefixing and suffixing the names of types enables cleaner operation when custom plugins are used that may generate multiple representations of the same underlying type. Fixes bufbuild#1017
I understand the use case - I've maintained code bases before that had to use import aliases. But this feature isn't without drawbacks:
The inconvenience of import aliases is real, but the feature doesn't enable new use cases. Because of the drawbacks and the added maintenance costs, we are not going to support this feature. As an alternative, we suggest the following options:
|
It would be great if we could simply add a line to
buf.gen.yaml
that made the generator add a prefix to the generated types' names. For example, I would just saytypesPrefix: "Pb"
in the yaml file, and then for this proto enum:the generated TS code would be
Same for message types and their TS classes. The motivation for this request is to avoid name collisions between generated TS types and manually-written types that correspond to them. Without this feature I have to manually alias names when I import them, as in
The text was updated successfully, but these errors were encountered: