-
Notifications
You must be signed in to change notification settings - Fork 1
OpenAPI support #6
Description
The API contract between cordon-cli and cordon-web is currently implicit: Go structs on one side, TypeScript types on the other. Changes on either side can silently break sync. We should define the contract as an OpenAPI 3.1 spec and generate types for both repos.
Endpoints in scope
POST /api/v1/auth/device, POST /auth/token, POST /auth/revoke, GET /auth/me
GET /api/v1/perimeters/lookup
GET/POST /api/v1/perimeters/{perimeterId}/policy/events
POST /api/v1/perimeters/{perimeterId}/data/ingest
Proposed approach
Write openapi.yaml spec covering all sync-facing endpoints (request/response schemas, error shapes)
Use
oapi-codegen
to generate Go types (and optionally a client) in cordon-cli
Wire generated types into the existing sync code (cli/cmd/sync.go, cli/internal/policysync/, cli/internal/api/client.go)
CI check to verify generated code stays in sync with the spec