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: use correct Rust variant name for enum aliases #94

Closed
wants to merge 1 commit into from

Conversation

jstarks
Copy link

@jstarks jstarks commented Feb 22, 2023

This change fixes code generation of protobuf enums when aliases are present.

This change fixes code generation of protobuf enums when aliases are
present.
@tustvold
Copy link
Contributor

Closed by #103

@tustvold tustvold closed this Sep 17, 2023
@jstarks
Copy link
Author

jstarks commented Sep 18, 2023

Won't #103 just ignore the aliases in deserialize? This seems incomplete and will lead to deserialization failures.

@tustvold
Copy link
Contributor

You can define aliases by assigning the same value to different enum constants. To do this you need to set the allow_alias option to true, otherwise the protocol compiler generates a warning message when aliases are found. Though all alias values are valid during deserialization, the first value is always used when serializing.

That is a valid point, I would be happy to review a PR to address this aspect and add a corresponding test for it

@jstarks
Copy link
Author

jstarks commented Sep 18, 2023

This PR addressed addressed that aspect, but it didn't add an explicit test.

Unfortunately, I am having trouble getting the CLA signed, so it might be better to reimplement this (small) change.

@sporkmonger
Copy link
Contributor

sporkmonger commented Nov 1, 2023

I can take a look at this gap in a bit since I don't have any limitations with respect to the CLA.

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.

3 participants