Shared wire-types module across API, agent, and provider #15

Open
opened 2026-07-26 17:05:50 +10:00 by benvin · 0 comments
Owner

Problem. Rendered-config and model types are duplicated across
tomswallapi (compiler output), tomswall (internal/agent), and the Terraform
provider (client structs). Three hand-synced copies of the same schema is a
standing invitation for skew — and skew here means silent policy gaps (see
tomswall #1).

Proposal. Extract one Go module (e.g. tomswall-types) owning: the
rendered per-device config schema (with schema_version), the API
request/response DTOs, and the source/dest selector grammar parser. All three
repos import it; drift becomes a compile error. Alternative: an OpenAPI spec
in this repo with generated clients — heavier, but also gives you #17's
plan-time validation for free.

**Problem.** Rendered-config and model types are duplicated across tomswallapi (compiler output), tomswall (`internal/agent`), and the Terraform provider (client structs). Three hand-synced copies of the same schema is a standing invitation for skew — and skew here means silent policy gaps (see tomswall #1). **Proposal.** Extract one Go module (e.g. `tomswall-types`) owning: the rendered per-device config schema (with `schema_version`), the API request/response DTOs, and the source/dest selector grammar parser. All three repos import it; drift becomes a compile error. Alternative: an OpenAPI spec in this repo with generated clients — heavier, but also gives you #17's plan-time validation for free.
Sign in to join this conversation.