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

Add support for JSON/camelcase conversion #2705

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

malthe
Copy link

@malthe malthe commented Jul 25, 2023

This adds a new configuration boolean configuration "json.field.names" (defaults to false) which controls whether to convert to JSON/camelcase from protobuf field names (which are underscore-separated by convention) – in toConnectData.

Conversely, going from the internal data representation, if this option is enabled, we convert from JSON/camelcase back to underscore-separated – in fromConnectData.

Note that this option is compatible with the Protobuf Style Guide in the sense that for some languages (e.g. Java), the underscore field naming is translated to camelcase-based methods.

@malthe malthe requested a review from a team as a code owner July 25, 2023 10:18
@malthe malthe force-pushed the features/protobuf-json-field-names branch from a9cb8d4 to 3511242 Compare July 25, 2023 11:30
@malthe malthe force-pushed the features/protobuf-json-field-names branch from 3511242 to 810423f Compare July 25, 2023 13:15
@rayokota
Copy link
Member

Thanks for the PR @malthe . Perhaps when going from Protobuf to Connect, it might be better to preserve the original field name as a Connect schema parameter. Then when going from Connect to Protobuf, we can just use the value of such a parameter, if it exists.

@malthe
Copy link
Author

malthe commented Aug 4, 2023

@rayokota fwiw, in parallel to this, we have contributed improvements to the ChangeCase transform from https://www.confluent.io/hub/jcustenborder/kafka-connect-transform-common/ such that it works on nested data structures.

This is a more generic approach and the performance will be slightly lower due to having to traverse each data structure.

@cla-assistant
Copy link

cla-assistant bot commented Sep 25, 2023

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

None yet

2 participants