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

Support unknown fields in clone #758

Merged
merged 3 commits into from
Mar 21, 2024
Merged

Support unknown fields in clone #758

merged 3 commits into from
Mar 21, 2024

Conversation

srikrsna-buf
Copy link
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
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
6 checks passed
@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