Adding a new field to Avro schema made it incompatible with an earlier version

47 views Asked by At

I have a working Avro Schema which is:

{ 
  "namespace": "sample.avro",
  "type": "record",
  "name": "MessageStatusFeedback",
  "fields": [
    {"name": "messageId", "type": "string"},
    {"name": "messageStatus", "type": "string"},
    {"name": "messageBody", "type": "string", "default": ""}
  ]
}

I'm trying to accept a dynamic JSON from Kafka producer, for which I appended a map to the original schema as follows:

{
  "namespace": "sample.avro",
  "type": "record",
  "name": "MessageStatusFeedback",
  "fields": [
    {"name": "messageId", "type": "string"},
    {"name": "messageStatus", "type": "string"},
    {"name": "messageBody", "type": "string", "default": ""},
    {"name": "payload", "type": {"type": "map", "values": ["null", "int", "string"] }}
  ]
}

On registration of this schema with the same subject (used for the previous schema), I get the error:

{"error_code":409,"message":"Schema being registered is incompatible with an earlier schema"}

Could someone suggest as to what might be the issue here?

Thanks.

0

There are 0 answers