Skip to content
Open

3.x #419

Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/runtime/src/reflection-merge-partial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import type {UnknownMessage, UnknownOneofGroup} from "./unknown-types";
* Note that this function differs from protobuf merge semantics,
* which appends repeated fields.
*/

export function reflectionMergePartial<T extends object>(info: MessageInfo, target: T, source: PartialMessage<T>) {

let
Expand All @@ -38,14 +39,13 @@ export function reflectionMergePartial<T extends object>(info: MessageInfo, targ

if (field.oneof) {
const group = input[field.oneof] as UnknownOneofGroup | undefined; // this is the oneof`s group in the source
if (group?.kind !== name) { // the user is free to omit
if (group?.kind == undefined) { // the user is free to omit
continue; // we skip this field, and all other members too
}
fieldValue = group.value; // our value comes from the the oneof group of the source
output = (target as UnknownMessage)[field.oneof] as UnknownOneofGroup; // and our output is the oneof group of the target
output.kind = group.kind; // always update discriminator
name = "value"; // the field name for a oneof's value is always 'value'

@jcready jcready Mar 20, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This removal seems unintentional and might break stuff. The commit seems unrelated 5cd88e2.

if (fieldValue === undefined) {
if (fieldValue == undefined) {
delete output.value; // remove any existing value
continue; // skip further work on field
}
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.