title: How to convert an Avro message deserialized with an older version of the schema into the newer, compiled schema?
body: <p>Let's say I used avro-tools to generate code for v2 of &quot;mySchema&quot;, and a message comes on a queue that was written with v1 of &quot;mySchema&quot;. If I understand right, the best way to handle the situation is to realize that the message was written with v1 of &quot;mySchema&quot;, get the v1 schema using a schema registry, and deserialize the message using v1.</p>
  <p>At this point, is it at all possible to somehow convert the resulting objects into the corresponding fields and objects from the avro-tools generated code for v2?</p>
  <p>So far, it looks like the only way to handle the message results in a &quot;GenericRecord&quot; which requires string keys to access the values of the fields. I'd much prefer to use the generated code for v2 and turn any typos into compile errors instead of runtime errors, know the data type of the value while coding, and avoid setting up a bunch of enums to contain the string keys.</p>