Files
go-config/docs/asr/ASR-0003-uniform-codec-api-and-source-abstraction.md
T
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

26 lines
875 B
Markdown

# ASR-0003: Uniform codec API and Source abstraction
## Context
Users switch between YAML, JSON, INI, and env-file formats; a different function surface per format would increase cognitive load and test matrices.
## Decision
1. Every format package exports **`New(opts...) *Codec`** with **`Map`**, **`Unmarshal`**, **`UnmarshalContext`**, **`Marshal`**, **`WriteTo`**.
2. Bytes, readers, files, and URLs are modeled by **`internal/source.Source`** with **`Open(ctx) (io.ReadCloser, error)`**.
3. HTTP(S) sources support **`WithHTTPHeader`** and **`WithHTTPClient`**.
## Consequences
- Cross-format examples in the README stay structurally identical.
- URL behaviour is testable with `httptest` against our client only.
## Status
Accepted — 2026-05-02.
## References
- ASR-0005 — merge semantics across multiple sources
- ASR-0008 — httptest policy alignment