confluent-kafka-dotnet icon indicating copy to clipboard operation
confluent-kafka-dotnet copied to clipboard

Unspecified attributes of an Avro Schema are not saved to the Schema Registry

Open unfw opened this issue 6 years ago • 1 comments

Description

The schema saved to schema registry does not save all attributes in an Avro object. For example if we include a "doc" property, it is not saved by the schema registry package which can cause compatibility issues. According to the Avro spec, unspecified attributes are allowed as metadata but must not affect the format of the serialized data.

How to reproduce

Have a schema with property types that are not saved such as below and write a message to a topic with producer.ProduceAsync

{
  "type": "record",
  "name": "Test",
  "doc": "Test Doc",
  "fields": [
    {
      "name": "Guid",
      "type": {
        "type": "string",
        "logicalType": "guid"
      }
    }
  ]
}

Output:

You will see in the schema registry the following schema which removes the non specified attributes.

{
  "type": "record",
  "name": "Test",
  "fields": [
    {
      "name": "Guid",
       "type": "string",
    },
  ]
}

Checklist

Please provide the following information:

  • [x] Confluent.Kafka nuget version: 0.11.4-RC2
  • [ ] Apache Kafka version:
  • [ ] Client configuration:
  • [ ] Operating system:
  • [ ] Provide logs (with "debug" : "..." as necessary in configuration)
  • [ ] Provide broker log excerpts
  • [ ] Critical issue

unfw avatar Sep 27 '18 18:09 unfw