feat(api): phase 3 step 1 — topology request/response models + router skeleton
Add Pydantic DTOs in decnet/web/db/models.py covering every phase-3 endpoint shape: TopologyGenerateRequest, TopologySummary/Detail, child create/update requests, MutationEnqueueRequest (Literal op guard), MutationRow with JSON-payload decoder, validation/version/not-editable error envelopes, and the three catalog responses. Create decnet/web/router/topology/ as an import-safe package exporting topology_router (prefix /topologies) — sub-routers land step-by-step in subsequent commits. Mount under the main api router alongside swarm_mgmt. tests/api/topology/test_models.py pins repo-dict ↔ DTO parity so future repo-row drift breaks the contract test before the endpoints.
This commit is contained in:
@@ -24,6 +24,7 @@ from .artifacts.api_get_artifact import router as artifacts_router
|
||||
from .swarm_updates import swarm_updates_router
|
||||
from .swarm_mgmt import swarm_mgmt_router
|
||||
from .system import system_router
|
||||
from .topology import topology_router
|
||||
|
||||
api_router = APIRouter(
|
||||
# Every route under /api/v1 is auth-guarded (either by an explicit
|
||||
@@ -83,3 +84,6 @@ api_router.include_router(swarm_mgmt_router)
|
||||
|
||||
# System info (deployment-mode auto-detection, etc.)
|
||||
api_router.include_router(system_router)
|
||||
|
||||
# MazeNET Topologies (nested topology CRUD + mutation queue)
|
||||
api_router.include_router(topology_router)
|
||||
|
||||
18
decnet/web/router/topology/__init__.py
Normal file
18
decnet/web/router/topology/__init__.py
Normal file
@@ -0,0 +1,18 @@
|
||||
"""MazeNET topology REST endpoints (phase 3).
|
||||
|
||||
Thin FastAPI layer over the phase-2 topology machinery:
|
||||
generate/validate/deploy/teardown, pending-only child CRUD, and the
|
||||
live-mutation queue for active|degraded topologies.
|
||||
|
||||
Mounted at ``/api/v1/topologies`` by the main api router. Sub-routers
|
||||
live one-per-file and are aggregated here.
|
||||
"""
|
||||
from fastapi import APIRouter
|
||||
|
||||
topology_router = APIRouter(prefix="/topologies", tags=["topologies"])
|
||||
|
||||
# Sub-routers land in later steps; this skeleton keeps the package
|
||||
# import-safe so the main api router can mount it immediately.
|
||||
|
||||
|
||||
__all__ = ["topology_router"]
|
||||
Reference in New Issue
Block a user