If I add a nullable field to an Event, do I need to increase the Revision number?

This seems a very basic question, but I have not found an answer to it yet…

I need to add a nullable field to an Event. (I’m using Kotlin).
The question is if I need to increase the Revision number?

I tried writing an upcaster, but then I realized that the serialized version of the upcasted event would be equal to the serialized version of the original event.
In other words, the serialization of MyEvent v6 is equal to the serialization of MyEvent v7.

So, do I need to increase the Revision number from 6 to 7 at all? If yes, do I still need to write an upcaster?

I read Versioning Events - Axon Reference Guide (axoniq.io) and the “Event Versioning” page in the Axon Reference Guide. I also found Upcast, Kotlin and Unit Test - Imported from Google Groups - Discuss.AxonIQ .
But these don’t seem to answer my question.

Any help would be appreciated.

Hi @Barth, and welcome to the forum!

Whether or not you need to change the revision of an event depends mainly on whether the previous serialized format fits in the new serialized format.

Things that can influence this behavior can be:

  1. Language-specific, as with Kotlin in your scenario.
  2. Library-specific, as something like Lombok can also fill in defaults for you easily.
  3. Serializer (configuration) specific, as some serializers are more lenient or can be configured to be more lenient.

So, in your case, I don’t think you have to change your revision for technical purposes.
However, from some perspectives, you can argue that “you made a change to the event, so you up the version number.” Simply to show the team that the event has changed.

Whether you would go for such a ‘rigid’ approach is up to you and your team, though.
As both ways work equally fine, as long as everybody’s aware of the decision.

By the way, we did release new course material to our Academy recently that covers upcasters in detail.
The course is called “Advanced Message Handling in Axon,” and you can find it here.