-
Notifications
You must be signed in to change notification settings - Fork 0
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
Replace repeated messages instead of appending more #55
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
julik
requested changes
Mar 20, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not entirely clear what the desired behavior is here - and this needs a test
skatkov
changed the title
Replace enum messages, don't concut them
Replace enum messages, don't append them
Mar 20, 2024
julik
reviewed
Mar 21, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GTG let's just make the wording in the tests a bit nicer pls
skatkov
force-pushed
the
fix-enums
branch
2 times, most recently
from
March 22, 2024 09:17
2210e6f
to
61fa3eb
Compare
adjust comments adding a test fixing dupplicated fields replace Array.wrap with simpler form update changelog
julik
changed the title
Replace enum messages, don't append them
Replace repeated messages instead of appending more
Mar 22, 2024
julik
approved these changes
Mar 22, 2024
julik
pushed a commit
that referenced
this pull request
Mar 22, 2024
This is a breaking change. Previously, we would handle repeated fields as something you can call multiple times on the builder, like so: ``` pb.messages "This is the first string of the repeating ones" pb.messages "This is the second one" ``` From now, this is no longer going to work and you need to assign all the messages in one go: `pb.messages ["This is the first string of the repeating ones", "This is the second one"] ` This behaviour is in alignment with how `jbuilder` handles this. The last assignment wins, the previous one will be discarded. `pb.messages ["This is the second one"]` It seems that rails-twirp gem does double rendering sometimes and some fields have duplicated values. e.g. `pb.redemption_methods [:instore, :online]` could end up in putput as `[:instore, :online, :instore, :online]` That bug we are going to fix as well, but for now making repeated fields safer is a good first step.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Two bug fixes in one!
Double definition bug
This code right now equals to this:
pb.messages ["This is the first string of the repeating ones", "This is the second one"]
But jbuilder handles this case differently. So in this PR behaviour is change to one similar to jbuilder - only last definition will be persisted and first one will be discarded.
pb.messages ["This is the second one"]
Double render bug
It seems that rails-twirp gem does double rendering and we're having fields with duplicated values. e.g.
pb.redemption_methods [:instore, :online]
could end up with as
[:instore, :online, :instore, :online]