Add data-driven config validation via embedded schema #50

Merged
heiko merged 1 commit from feature/schema-validation into dev 2026-05-13 17:27:19 +02:00
Owner

Summary

  • Replace hand-coded enum checks with a declarative schema.yml (embedded via //go:embed)
  • A reflection-based walker validates config fields against type/enum constraints
  • Wildcard paths (publish.destinations.*.type) iterate maps automatically
  • Cross-field rules (route compatibility, conditional requires) remain in Go code
  • Adding a new validated field now only requires a schema.yml entry

Test plan

  • go build ./... passes
  • go vet ./... clean
  • go test ./... all green
  • Set build.strip: bogus → verify doctor/validation catches it
  • Set artifacts.deb.priority: wrong → verify schema catches it
  • Add unknown key → verify KnownFields(true) still rejects it
## Summary - Replace hand-coded enum checks with a declarative `schema.yml` (embedded via `//go:embed`) - A reflection-based walker validates config fields against type/enum constraints - Wildcard paths (`publish.destinations.*.type`) iterate maps automatically - Cross-field rules (route compatibility, conditional requires) remain in Go code - Adding a new validated field now only requires a `schema.yml` entry ## Test plan - [x] `go build ./...` passes - [x] `go vet ./...` clean - [x] `go test ./...` all green - [x] Set `build.strip: bogus` → verify doctor/validation catches it - [x] Set `artifacts.deb.priority: wrong` → verify schema catches it - [x] Add unknown key → verify `KnownFields(true)` still rejects it
Replace hand-coded enum checks with a declarative schema.yml that
defines field constraints (type, allowed values). A reflection-based
walker validates the config struct against it, including wildcard
map iteration for publish.destinations.*.type.

Cross-field rules (route compatibility, conditional requires) remain
in validation.go. Adding a new validated field now only requires a
schema.yml entry.

AI-assisted-by: Claude (Anthropic)
heiko deleted branch feature/schema-validation 2026-05-13 17:27:19 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
heiko/gogogo!50
No description provided.