I have been working with a Kotlin/SpringBoot and opted for the URI API Versioning approach. I am, however, very unsure on how to go about versioning model, DTO, repository and service classes. What is the best approach to follow. I give you an example from my controller:
As you can see, I have two @GetMapping with two versions of the service method getCustomers (V1 and V2). I also have a change in the model (one additional field), so I have created a new version of CustomerDto (v2). Is this the correct approach? Change in the model also required me to modify the Dto converter as well as the Repository. Is it good norm to have multiple versions of the repository considering that there has been a change in the model?
I would only consider applying a versioning strategy to the public API of your system as a courtesy to your users providing backwards compatibility. How you organise your code behind that API is entirely up to you so do whatever makes the most sense to you and the other maintainers of the code (if any).