feat(api): topology endpoints (catalog / classify / build)
Stateless, auth-gated routes backing the topology builder UI:
- GET /api/topologies — catalog of the 12 kinds + descriptions + role mix
- POST /api/topologies/classify — infer a kind + metrics from a posted graph
- POST /api/topologies/build — build a canonical graph from {kind, roles}
Add Serialize to cm-topology Classification/GraphMetrics; add ApiError::BadRequest
(400) for invalid build input; add cm-topology dep. 3 integration tests
(catalog/build/auth) green against Postgres; offline build + clippy clean.
No DB or provider yet — running/comparing topologies is a later provider-backed
endpoint. Server redeploy will batch with the ReactFlow UI that consumes these.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
b0c122b88d
commit
fa7e5dec5f
@@ -8,12 +8,14 @@
|
||||
|
||||
use std::collections::VecDeque;
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::graph::TopologyGraph;
|
||||
use crate::kind::TopologyKind;
|
||||
|
||||
/// Objective structural metrics for a topology graph (treated undirected for
|
||||
/// connectivity, directed for hierarchy).
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize)]
|
||||
pub struct GraphMetrics {
|
||||
/// Number of nodes.
|
||||
pub order: usize,
|
||||
@@ -38,7 +40,7 @@ pub struct GraphMetrics {
|
||||
}
|
||||
|
||||
/// The result of [`classify`].
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize)]
|
||||
pub struct Classification {
|
||||
/// Best-matching topology kind.
|
||||
pub primary: TopologyKind,
|
||||
|
||||
Reference in New Issue
Block a user