Problem
Public render methods currently require map[string]any root bindings. Struct values work when nested under a map key, but callers cannot pass a struct directly and expose its fields at the template root.
Proposed direction
Add a backward-compatible API that accepts a struct, map, or another supported root object and adapts it to the existing lookup semantics. Existing map-typed methods should remain available.
The behavior should reuse the same field visibility, naming, and struct-tag rules as nested struct values. It should return a clear error for unsupported root kinds rather than panic.
Acceptance criteria
- Existing map-based APIs remain source compatible.
- Public struct fields are available at the root.
- Root and nested structs use consistent field-name rules.
- Pointer, nil-pointer, embedded-field, tag, and conflict cases are tested.
- The implementation does not require eagerly copying every field when the existing value abstraction can provide lookup.
Problem
Public render methods currently require
map[string]anyroot bindings. Struct values work when nested under a map key, but callers cannot pass a struct directly and expose its fields at the template root.Proposed direction
Add a backward-compatible API that accepts a struct, map, or another supported root object and adapts it to the existing lookup semantics. Existing map-typed methods should remain available.
The behavior should reuse the same field visibility, naming, and struct-tag rules as nested struct values. It should return a clear error for unsupported root kinds rather than panic.
Acceptance criteria