Skip to content

SI-7: Review tests and align v1 namespace across REST API packages #1959

Description

@josecelano

Subissue of EPIC #1938 — REST API Contract-First Migration

Problem

During the contract-first migration (SI-1 through SI-5), production code was moved from axum-rest-api-server to the new layered packages (rest-api-protocol, rest-api-application, rest-api-runtime-adapter). However, two issues remain:

  1. Tests left in wrong package: The file axum-rest-api-server/src/v1/context/torrent/resources/torrent.rs contains unit tests for conversion functions that now live in rest-api-runtime-adapter::conversion. These tests should be moved alongside their production code.

  2. Inconsistent v1 namespace: Packages rest-api-application and rest-api-runtime-adapter expose their modules at the top level, while rest-api-protocol, axum-rest-api-server, and rest-api-client use a v1/ module. The two outlier packages should be aligned.

Scope

Part A: Move misplaced tests

  • Move conversion tests from axum-rest-api-server/src/v1/context/torrent/resources/torrent.rs to rest-api-runtime-adapter::conversion.
  • Remove empty stub axum-rest-api-server/src/v1/context/torrent/resources/peer.rs and its module declaration.

Part B: Align v1 namespace

  • Add v1/ module to rest-api-application and move ports/ and use_cases/ under it.
  • Add v1/ module to rest-api-runtime-adapter and move adapters/, container.rs, conversion.rs under it.
  • Update all internal imports across the workspace.

Checklist

  • Conversion tests moved to rest-api-runtime-adapter
  • Empty peer.rs stub removed
  • rest-api-application has v1/ module with ports + use-cases
  • rest-api-runtime-adapter has v1/ module with adapters + container + conversion
  • All internal imports updated
  • Workspace builds cleanly
  • Pre-commit and pre-push checks pass

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions