-
Notifications
You must be signed in to change notification settings - Fork 345
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
Incorrect message names in the generated code for repeated fields #1072
Closed
avlyalin opened this issue
Jul 10, 2024
· 2 comments
· Fixed by #1073 · May be fixed by habyyb/CD-AdvancedDigitalIQ#3
Closed
Incorrect message names in the generated code for repeated fields #1072
avlyalin opened this issue
Jul 10, 2024
· 2 comments
· Fixed by #1073 · May be fixed by habyyb/CD-AdvancedDigitalIQ#3
Labels
Comments
Ah! Your diagnosis is exactly right; we need to keep the |
🎉 This issue has been resolved in version 1.181.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Thanks for the lib 🙂
Problem
In the proto files for which I generate TS code, there are messages with the same names but in different packages. For example, within one message, there can be a field of a type with the same name, but from a different package.
It's easier to demonstrate with an example:
In the code generated for api.proto, the import of
User
includes an alias to avoid collisions:However, in the constructor methods
toJson
andfromJson
ofUser
(inapi.ts
) incorrect message name is generated. Instead of the aliasUser1
, there isUser
(User.fromJson
/User.toJson
) in map-functions:For non-repeated fields, the correct alias
User1
is created.Solution
After studying the code, I guess I found a place with an error. Calling toCodeString, toString leads to caching of the calculated value (code, codeWithImports).
As far as I understand, because of this, when code is generated from all the collected
Code
instances later, these objects retain an incorrect value that does not take into account the necessary parameters/context.I've opened a small PR, that fixes this.
The text was updated successfully, but these errors were encountered: