Files
go-config/docs/asr/ASR-0004-configurable-key-normalization.md
eSliderandCursor c575341178 feat(go-config): multi-format codecs, envc CLI, fixtures, ASRs
- Module github.com/eslider/go-config with env/yaml/json/ini packages
- internal: source, keymap, merge, structconv, bytesutil
- cmd/envc: convert, get, merge
- docs/asr ASR-0001..0008, README/CHANGELOG/AGENTS refresh
- golangci-lint v2 config; tests + fixtures

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-02 14:04:01 +01:00

24 lines
732 B
Markdown

# ASR-0004: Configurable key normalization
## Context
Real-world configuration mixes `kebab-case`, `snake_case`, `SCREAMING_SNAKE`, and struct field names. Requiring `mapstructure` tags on every field is noisy.
## Decision
1. After parsing and merging, codecs run **`internal/keymap.Walk`** with a **`Normalizer`** (default **`LowerAlnum`**: lowercase + strip non `[a-z0-9]`).
2. Callers may set **`WithKeyNormalizer(nil)`** to disable walking, or supply a custom function.
## Consequences
- POSIX env keys without `-` still align with YAML keys that contain hyphens once normalized.
- CLI `get` applies the same normalizer to each path segment for consistency.
## Status
Accepted — 2026-05-02.
## References
- ASR-0003