[BUG] SchemaRegistryAvroSerializer Does Not Produce Same Avro as Javascript Serializer #22110
Labels
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Schema Registry
Milestone
Describe the bug
The java sdk SchemaRegistryAvroSerializer is not compatible with schemas uploaded by the javascript sdk SchemaRegistryHandler.
Main issue: The schema name, uploaded by the js SchemaRegistryHandler, does not contain the namespace only the name of the record.
Fact: The java SchemaRegistryAvroSerializer uses the full schema name from the local avro class to match with published schemas on the event hub schema registry.
Subsequent issue: The java SchemaRegistryAvroSerializer can not serialize/deserialize avro records using schemas published with js SchemaRegistryHandler.
Solution Idea:
Making the java sdk backward compatible with the js sdk would be the wrong solution, updating the js sdk would be the real fix.
As a minor flexibility fix, I suggest making the AvroSchemaRegistryUtils public and accessible in the SchemaRegistryAvroSerializerBuilder, enabling the caller to extend the AvroSchemaRegistryUtils class and overriding getSchemaName() method.
To Reproduce
Upload avro schemas using the js azure library "@azure/schema-registry": "^1.0.0-beta.1”. Deserialize/serialize schemas using the java library “azure-data-schemaregistry-avro”: “1.0.0-beta.5”.
Code Snippet
String getSchemaName(Object object) {
return AvroSchemaUtils.getSchema(object).getFullName();
}
Expected behavior
AvroSchemaRegistryUtils should not be package private and accessible in the SchemaRegistryAvroSerializerBuilder.
The js SchemaRegistryHandler should upload schemas using the FullName (containing namespace).
The text was updated successfully, but these errors were encountered: