Skip to content

feature: minimal topology endpoint (stretch) #135

@xnorkl

Description

@xnorkl

Hackathon positioning

Stretch goal for v0.3.0-Hackathon. Not required for PCAP replay → Zeek → asset ingest unless product/judges explicitly need /api/topology. Core milestone path is #49, #50, #116.


Summary

Ship a read-only minimal topology endpoint that returns one snapshot document matching minimal_network-topology-schema-v0.json and the example in-repo.

Context

This is the v0.3.0 topology contract. The endpoint should be small, deterministic, and schema-first. Asset.hostname is used as asset.id; until #137 is complete, assets without hostname are excluded and that behavior is documented.

Goal

Expose a single topology snapshot route that returns schema-valid JSON and is documented in OpenAPI as the same contract version.

Acceptance criteria

  • GET /api/topology/ (or agreed equivalent) returns one snapshot object that validates against minimal_network-topology-schema-v0.json (automated test with jsonschema).
  • Response includes required root fields (schema_version, snapshot_id, timestamp, assets) and uses the minimal schema's field types/enums/patterns.
  • asset.id is sourced from Asset.hostname; assets with null/empty hostname are excluded until Enforce hostname as stable identity on Asset for topology #137, and this is stated in API docs/OpenAPI description.
  • Empty-state/error behavior is explicitly defined and tested (pick one: 200 with empty assets or 404).
  • OpenAPI for the topology endpoint points to the same minimal schema artifact/version used by tests.

Implementation guidance (non-binding)

  • Reuse existing models (Asset, NetworkEndpoint) without introducing new topology models in this issue.
  • Keep the endpoint read-only and non-paginated.
  • Derive services in a way that stays schema-valid; detailed enrichment logic can evolve in follow-ups.

Non-goals

Metadata

Metadata

Assignees

No fields configured for Feature.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions