Project

General

Profile

Actions

Refactor #3866

closed

API v1/v2 code duplication

Added by Daniel Lobato Garcia over 10 years ago. Updated over 6 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
API
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

API v2 and v1 share a lot of code both in tests and controllers. Refactoring the controllers is going to be somewhat complicated, but the tests are easy to refactor.

As an example, I compared hostgroups_controller for api v1 and v2 and the results are.. interesting.

https://gist.github.com/eLobato/7926170

The only difference here is literally 2 lines of code and the string V1 is replaced by V2. This same duplication happens at environments API controller and others. For every API controller that is duplicated in this way around 150 extra (duplicated) lines of code need to be maintained.


Related issues 1 (0 open1 closed)

Related to Foreman - Feature #3017: API v2 - create separate controller for all objects rather than fallback to v1ClosedJoseph Magen09/03/2013Actions
Actions #1

Updated by Dominic Cleal over 10 years ago

  • Related to Feature #3017: API v2 - create separate controller for all objects rather than fallback to v1 added
Actions #2

Updated by Tomer Brisker over 6 years ago

  • Status changed from New to Rejected

APIv1 will be dropped from core in #11389 along with the duplication. Closing.

Actions

Also available in: Atom PDF