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

Adds functionality to schema_registry_decode to emit defaults or not #2855

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

hendoxc
Copy link

@hendoxc hendoxc commented Sep 9, 2024

What

This PR allows users to specify different behaviour for schema_registry_decode when decoding protobuf messages; allowing them to chose to Emit defaults.

Why

if a protobuf message like {"a": 0, "b": 1} is encoded to protobuf, when we decode with schema_registry_decode the resulting message is {"b": 1} and the keyval "a": 0 is lost.

This behaviour is controlled from protojson.MarshalerOpts with the field EmitDefaultValues, which by fault is false.

This allows zero value fields and empty strings to NOT be omitted when using `schema_registry_decode` to decode protobuf messages

Originally having a protobuf message like `{"a": 1, "b": 0}` after `schema_registry_decode` would result in `{"a": 1}`, this allows user to specify if that is the intended behaviour or not
@CLAassistant
Copy link

CLAassistant commented Sep 9, 2024

CLA assistant check
All committers have signed the CLA.

@ntx-ben
Copy link

ntx-ben commented Nov 14, 2024

Currently facing this issue. Any updates on this?

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.

3 participants