jcustenborder / xjc-kafka-connect-plugin

Kafka Connect plugin to extend code generated by xjc to produce Kafka Connect Schemas and Structs.
3 stars 7 forks source link

Decimals are not properly setting a schema. #9

Open jcustenborder opened 5 years ago

joncourt commented 4 years ago

this looks a little tricky. the schema for 'decimal' is hard coded to 12 which fixes it across the whole schema for all decimal values, it's a limitation of Kafka Connects Schema object that you must set a scale. I wonder if we can make Kafka Connects Decimal accept a scale as part of the value rather than fixing it in the schema. There doesn't appear to be a way to fix this problem properly inside the xjc-kafka-connect-plugin so i'll take a look at Kafka Connect's codebase to see if there's a way to improve it there.

I did have a go fixing this with a config setting and forcing it on the incoming decimals - it's ugly but at least a user can set the scale rather than just accept '12' or perhaps the max. I don't like it though and it breaks a bunch of tests because the decimal scale is different between expected and actual. It's too 'surprising' though so i've not PR'd it.

If you have any ideas @jcustenborder I'm in the codebase at the moment and able to fix.