Skip to content

feat : Refactor oversized REST controller into smaller capability-focused controllers and services #3892

@devlopharsh

Description

@devlopharsh

Description

The current REST controller has grown beyond a thin HTTP layer and now mixes request handling, business orchestration, response assembly, link generation, request mapping, and resource embedding in one file. This makes the code difficult to read, test, and change safely.
Please describe your situation in few words here.
Files like ReleaseController currently handles multiple unrelated capabilities in a single class, including release listing and lookup, create/update/delete flows, attachment operations, etc . This violates separation of concerns. The controller is no longer a thin adapter layer and contains logic that belongs in dedicated controllers, assemblers, and application services.

Impact over the system

  • Large file size increases cognitive load.
  • Changes in one area can unintentionally affect unrelated endpoints.
  • Tests become broader and harder to isolate.
  • Reuse is poor because controller logic is tightly coupled.
  • HAL/resource assembly logic is duplicated or embedded in HTTP classes.
  • Future enhancements become slower and riskier.

Suggested Architecture

  • The Rest Controllers must be improvised to call service based operations majorly including :
  1. business orchestration
  2. HAL/resource construction
  3. request-to-domain mapping
  4. auth/user resolution/pagination parsing

Benifits :

Readable controllers , Structured and modular code , Better testability , Lower regression risk and Easier feature expansion for the future .

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions