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: Add missing defaults to fromPartial if options.oneof is UNIONS #375

Merged
merged 3 commits into from
Oct 26, 2021

Conversation

webmaster128
Copy link
Collaborator

Before this change, setting options.oneof to UNIONS would cause that the else block in fromPartial was never written, no matter if the field is part of the oneof or not. To illustrate, a simple bytes signature field was added to oneof-unions, which requires an else case to be properly initialized. With the change in main.ts, the missing code is now generated.

@@ -248,6 +264,8 @@ export const PleaseChoose = {
}
if (object.age !== undefined && object.age !== null) {
message.age = object.age;
} else {
message.age = 0;
Copy link
Collaborator Author

@webmaster128 webmaster128 Oct 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same code as in oneof-properties now

Comment on lines +289 to +291
} else {
message.signature = new Uint8Array();
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this change, those 3 lines were missing.

@webmaster128 webmaster128 changed the title Fix: Add missing defaults to fromPartial if options.oneof is UNIONS fix: Add missing defaults to fromPartial if options.oneof is UNIONS Oct 25, 2021
Copy link
Owner

@stephenh stephenh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

I added you as a collaborator, so feel free to merge and it should auto-release.

@webmaster128
Copy link
Collaborator Author

Thanks! But it says Only those with write access to this repository can merge pull requests. and I don't get a Mergie button or automerge option.

@webmaster128
Copy link
Collaborator Author

Nevermind, I just had to accept the invitation.

stephenh pushed a commit that referenced this pull request Oct 26, 2021
## [1.83.2](v1.83.1...v1.83.2) (2021-10-26)

### Bug Fixes

* Add missing defaults to fromPartial if options.oneof is UNIONS ([#375](#375)) ([21781e9](21781e9))
@stephenh
Copy link
Owner

🎉 This PR is included in version 1.83.2 🎉

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
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants