What is the correct way to update an Avro schema on a Kafka topic, if this schema is used as a reference in another schema?
For example, let's say we have two Kafka topics: one uses Avro schema User {"type" : "record", "namespace" : "test", "name" : "User", "fields" : [{"name": "username", "type": "string"}]} and the second one UserAction {"type" : "record", "namespace" : "test", "name" : "UserAction", "fields" : [{"name": "action", "type": "string"}, {"name": "user", "type": "test.User"}]}.
Then I want to add an additional field to the User - a "surname", so it will look like this: ... "fields" : [{"name": "username", "type": "string"}, {"name": "surname", "type": ["string", "null"], "default": null}], null to make this change a compatible one. To do this I can change the Avro schema file, regenerate POJOs using Maven schema plugin, and then if I'll send a message to the first topic with a KafkaTemplate, the schema will be updated and the new field will be visible on the topic.
The issue is that if I'll send a message with UserAction to the second topic, it would still refer to the old User schema, without the "surname" field, even though POJOs will see it correctly. And because of this any "surname" sent won't be stored in the topic and would be received as a null in Consumer.
Is there any way to force update UserAction schema on the second topic to refer to the new User schema?