Document and demonstrate native and layered configuration loading

This commit is contained in:
2026-09-29 18:22:45 +00:00
parent 34e18c84c1
commit cbf031aedc
21 changed files with 291 additions and 46 deletions

View File

@@ -26,10 +26,13 @@ type LayeredOptions[T any] struct {
Overrides []Override
}
// LoadLayered acquires the main input first, strictly composes each underlay,
// then applies underlays in order beneath main, a selected overlay, and CLI
// overrides. It performs defaults, decoding, resolution, and validation once.
// Zero or one options value is accepted; any error returns a nil result.
// LoadLayered acquires the main input first and strictly composes enabled
// imports with each input's tier. It strictly composes contributions within
// each underlay, then recursively combines underlays in listed order beneath
// main, a selected overlay, and CLI overrides. Defaults, decoding, resolution,
// and validation run once on the assembled input. Source IDs follow acquisition
// order, not precedence order. Zero or one options value is accepted; any error
// returns a nil result.
func LoadLayered[T any](main Input, supplied ...LayeredOptions[T]) (*Result[T], error) {
options := make([]engine.LayeredOptions[T], len(supplied))
for index := range supplied {