Skip to content
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

Fix an edge case in enum prefix stripping #246

Merged
merged 4 commits into from
May 8, 2024
Merged

Fix an edge case in enum prefix stripping #246

merged 4 commits into from
May 8, 2024

Conversation

ogolberg
Copy link
Member

If, after stripping the common prefix, the enum name starts with a digit - i.e. it's not a valid Protobuf name - the kotlin code, if escaped, will compile to java but fail to compile to javascript

the solution is to only strip the common prefix, if all stripped enum names remain valid protobuf names (which is equivalent to them not starting with a digit)

@andrewparmet
Copy link
Collaborator

What about stripping the prefix and prefixing the enum name with an underscore? I don't remember if we still do any underscore escaping of property names...

@ogolberg
Copy link
Member Author

I don't have a preference either way. The logic is a bit simpler with the current change; as in, we either strip or we do not strip the prefix.

@ogolberg ogolberg merged commit 06cc0e1 into main May 8, 2024
13 checks passed
@ogolberg ogolberg deleted the enum-names branch May 8, 2024 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants