-
-
Notifications
You must be signed in to change notification settings - Fork 91
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
BE: fixes: avro schema ser for nullable enums #685
base: main
Are you sure you want to change the base?
BE: fixes: avro schema ser for nullable enums #685
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi DimaVilda! 👋
Welcome, and thank you for opening your first PR in the repo!
Please wait for triaging by our maintainers.
Please take a look at our contributing guide.
hey there! "name": "booksize" then kafka-ui createUnionSchema AFTER MY FIX OFC method will transform it to: "booksize": { Which will generate a message for topic like: { However a simple enum (not nullable) looks like: { "name": "booksize" Kafka-ui will generate: { or for null: { What do you think? Can I create a following issue for it and then proceed with this ? |
could you review it pls since we use kafka ui in our project and we would like to have this problem fixed, don't want to be pushy but when you have time pls check it |
String oneOfFieldName = switch (f.getType()) { | ||
case RECORD -> f.getFullName(); | ||
case ENUM -> f.getName(); | ||
default -> f.getType().getName().toLowerCase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please keep the comment here that this if for primitive types? Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
potentially you can have 2 unums with same names but with different packages. This is why we getting full name in RECORD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Haarolean comment restored!
…r' into bugfix/fix_nullable_enum_avro_ser
What changes did you make?
Fixed incorrect JSON schema generation for nullable enum types in Avro schemas. Previously, nullable enums were generated with generic "enum" key instead of the actual enum name, causing incorrect serialization format with error:
400 Bad Request
json value '{"enum":"CLUBS"}' is cannot be converted to any of union types
See bug reproduction in attached video!
Is there anything you'd like reviewers to focus on?
We can think about changing nullable enums json generation. I.e. instead of :
Simply use
How Has This Been Tested? (put an "x" (case-sensitive!) next to an item)
Checklist (put an "x" (case-sensitive!) next to all the items, otherwise the build will fail)
kafkaUiBug.mp4