Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

URI API Versioning with Kotlin/SpringBoot: How to version model, DTO, repository and service

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
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?
 
Sheriff
Posts: 4968
318
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
You can thank my dental hygienist for my untimely aliveness. So tiny:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic