Build reusable schema descriptors
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
## Status and ownership
|
||||
|
||||
Status: implementation in progress; Stages 1–3 are complete and later stages are
|
||||
Status: implementation in progress; Stages 1–4 are complete and later stages are
|
||||
pending.
|
||||
|
||||
Audience: a `gpt-5.6-terra` coding agent implementing one stage per prompt, in
|
||||
@@ -463,7 +463,27 @@ Acceptance:
|
||||
|
||||
## Stage 4 — Build the reusable schema binding graph
|
||||
|
||||
Status: pending.
|
||||
Status: complete.
|
||||
|
||||
Completion evidence (2026-09-06):
|
||||
|
||||
- Implemented a per-operation private descriptor graph in [`schema.go`](../../schema.go)
|
||||
for structural roots, ordinary/named scalars, duration and paired text scalars,
|
||||
pointers, structs, string-keyed maps, slices, arrays, dynamic values, and recursive
|
||||
definitions. No global cache or application method execution is involved.
|
||||
- Implemented declared-field YAML binding, ignored/private fields, explicit struct/
|
||||
pointer/map inlining, ambiguity and tag validation, one inline map, secret-tag
|
||||
retention, and schema-aware key/index path traversal. Runtime default collisions,
|
||||
cyclic values, cloning, projection, and decoding remain assigned to later stages.
|
||||
- Added the [current schema contract](../config.md#application-schema-binding) and
|
||||
updated the component inventory and target-roadmap ownership links.
|
||||
- Focused tests cover nested and inline conflicts, ignored/private fields, maps of
|
||||
structs, named scalars, pointer text method sets, missing codec pairs, root and
|
||||
unsupported-kind rejection, recursive descriptors, side-effect freedom, dynamic
|
||||
and inline-map paths, parsed numeric indices, and array bounds. Verified
|
||||
`go test ./...`, `go vet ./...`, `go build ./...`, `go mod tidy -diff`, and
|
||||
`git diff --check` with Go 1.26.7 on linux/amd64. No deviations were required;
|
||||
typed value operations remain later work.
|
||||
|
||||
Read: feature [typed decoding](initial.md#typed-decoding) and
|
||||
[type/projection contract](initial.md#supported-types-and-projection).
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user