Build reusable schema descriptors

This commit is contained in:
2026-09-06 19:36:14 +00:00
parent 7c78da9cd2
commit 2b65876a7d
7 changed files with 789 additions and 17 deletions

View File

@@ -584,17 +584,16 @@ through validation. Null never means reset to the application default.
## Typed decoding
The schema-binding portion of this target is implemented. The [current application
schema contract](../config.md#application-schema-binding) owns root/type support,
field and tag binding, inlining, text-codec pairing, and schema-aware path rules.
The remaining document-to-value behavior below is target decoding work.
Strictness must be enforced by ConfigKit across the effective tree:
- Unknown struct fields, type mismatches, overflow, and invalid null are errors.
- Support ordinary exported fields and `yaml` names/ignore tags. Untagged field
names use the lowercase Go field name. Embedded structs follow the same rule
unless explicitly tagged `yaml:",inline"`; inline struct fields contribute to
the containing mapping. Permit at most one inline string-keyed map per object,
which receives otherwise unmatched keys. Duplicate declared field names and
default inline-map entries colliding with declared fields are schema errors.
Without an inline map, unmatched keys remain errors. Ignore `omitempty` for
decoding, defaults, and effective inspection.
- Without an inline map, unmatched keys remain errors. Default inline-map entries
colliding with declared fields are checked when runtime defaults are introduced.
- String-keyed maps accept application-defined keys. Struct values inside them
remain strict. `map[string]any` permits arbitrary keys and recursively accepts
the supported scalar/container model; application validation owns its schema.
@@ -1298,12 +1297,10 @@ model, not the application's separately constructed runtime module objects.
### Supported types and projection
The supported root `T` is a struct or string-keyed map. Within it, support ordinary
exported scalar fields, pointers, structs, string-keyed maps, slices, fixed-length
arrays, dynamic `any`, and the explicitly supported scalar conversions. Reject
unsupported kinds, non-string map keys, cyclic object graphs, and ambiguous field
bindings as schema/projection errors. Arrays require matching sequence length.
`yaml:"-"` fields and unexported fields are outside the configuration projection;
Supported schema types and field bindings are implemented and owned by the
[current application schema contract](../config.md#application-schema-binding).
Projection must additionally reject cyclic object graphs. Arrays require matching
sequence length. Ignored and unexported fields stay outside configuration projection;
hooks must not use them to carry runtime resources or configuration needing
inspection. Non-configuration runtime state belongs in separate application types.