Ivan, thanks for your feedback. I also agree with going to #3 as it seems the most DRY.
···----- Original Message ----- From: "Ivan Necas" To: "Joseph Magen" Cc: email@example.com, firstname.lastname@example.org Sent: Monday, December 10, 2012 11:07:17 AM Subject: Re: [katello-internal] Foreman API versioning
----- Original Message -----
I’m looking for feedback on the better way to maintain API versioning
in Foreman. Some options include
- Copy all controllers and views from /v1 to /v2 directories
- V2 controllers inherit v1 and render /v1 views (if not changed)
or /v2 views (if changed)
- Use routes.rb for directing to either /v1 to /v2 for each
controller#action. Only create v2 if there are changes.
Thanks for your feedback.
For me 3. is the favorite, for this reasons:
a. reduction of code duplicities
b. it’s immediately visible, what was added in the v2
c. the argument against controller inheritance might be, that it doesn’t conform to the substitutability principle , although I don’t like theorizing about OO very much. Let’s make an assumption there will be yet another version of the API (might happen), where this might cause some troubles as well.
The counter-argument against 2) and 3) might be what happens, when we obsolete the version one API. Personally I would leave the copying of the code till that time.