Skip to content

Support unknown fields in clone#758

Merged
srikrsna-buf merged 3 commits intomainfrom
sk/v1/clone/unknowns
Mar 21, 2024
Merged

Support unknown fields in clone#758
srikrsna-buf merged 3 commits intomainfrom
sk/v1/clone/unknowns

Conversation

@srikrsna-buf
Copy link
Copy Markdown
Member

@srikrsna-buf srikrsna-buf commented Mar 21, 2024

Support unknown fields in the method Message.clone().

Extensions are stored as unknown fields on a message, and cloning a message will currently discard any set extension. This behavior is unexpected, since it would be logical that a deep copy includes all properties that were explicitly set, whether it is a regular field, or an extension.

This PR fixes this flaw, and includes unknown fields when cloning a message.

This also documents equal's behavior of ignoring the unknown fields and extensions.

@srikrsna-buf srikrsna-buf requested a review from timostamm March 21, 2024 02:50
Copy link
Copy Markdown
Member

@timostamm timostamm left a comment

Choose a reason for hiding this comment

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

LGTM

(Edited the PR description, adding more context)

@srikrsna-buf srikrsna-buf merged commit 503e2f7 into main Mar 21, 2024
@srikrsna-buf srikrsna-buf deleted the sk/v1/clone/unknowns branch March 21, 2024 12:23
@timostamm timostamm mentioned this pull request Apr 22, 2024
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