Add single-source loading and version checks
This commit is contained in:
@@ -425,15 +425,16 @@ configuration is never returned as a successful, usable result.
|
||||
|
||||
Source ownership, the supported YAML subset, scalar grammar, fixed input limits,
|
||||
and safe failure behavior are implemented. The [current configuration input
|
||||
contract](../config.md) now owns those definitions. Typed scalar conversion into
|
||||
application values remains target work in [typed decoding](#typed-decoding).
|
||||
contract](../config.md) now owns those definitions, including typed scalar
|
||||
conversion through the current single-source lifecycle.
|
||||
|
||||
## Paths and presence
|
||||
|
||||
Semantic path construction, JSON Pointer parsing, and current metadata query
|
||||
declarations are implemented. Their current contracts are owned by the Go
|
||||
documentation in [`path.go`](../../path.go) and [`metadata.go`](../../metadata.go).
|
||||
The remaining presence behavior below is target lifecycle work.
|
||||
Semantic path construction, JSON Pointer parsing, and base/default metadata
|
||||
population are implemented. Their current contracts are owned by the Go
|
||||
documentation in [`path.go`](../../path.go), [`metadata.go`](../../metadata.go),
|
||||
and the [single-source configuration contract](../config.md#base-default-metadata).
|
||||
Layered replacement and resolution behavior below remains target lifecycle work.
|
||||
|
||||
Distinguish absent, explicitly null, explicitly zero/false/empty, and other
|
||||
explicit values. An explicit value equal to its default remains explicit.
|
||||
@@ -672,8 +673,11 @@ Automatic migration is deferred.
|
||||
|
||||
## Consumer API design
|
||||
|
||||
The following is a proposed public API, not implemented Go reference documentation
|
||||
or a frozen naming commitment. Declarations omit method bodies and private fields.
|
||||
The core declarations and single-source loading subset are implemented; their
|
||||
current contract is owned by [configuration input](../config.md#single-source-loading)
|
||||
and Go reference comments. Remaining declarations and behavior in this section are
|
||||
target design, not implemented Go reference documentation or a frozen naming
|
||||
commitment. Declarations omit method bodies and private fields.
|
||||
Consumer snippets assume the indicated standard-library imports and a `configkit`
|
||||
import using the module path selected in the [implementation plan](implementation.md#implementation-decisions).
|
||||
They are illustrative target examples, not currently runnable examples. The
|
||||
@@ -682,6 +686,13 @@ and verification against consumer models.
|
||||
|
||||
### Entry point and reusable application definition
|
||||
|
||||
`Load`, `Definition`, `Options`, `FilesystemContext`, `Override`, `VersionRule`,
|
||||
`Version`, `Validation`, and `Result` are declared. The current loader accepts only
|
||||
the defaults and version-checking subset described by the
|
||||
[single-source contract](../config.md#single-source-loading); later-feature fields
|
||||
fail explicitly rather than being ignored. The complete lifecycle and option
|
||||
behavior below remains the target as its owning stages land.
|
||||
|
||||
```go
|
||||
func Load[T any](source Source, options ...Options[T]) (*Result[T], error)
|
||||
|
||||
@@ -795,11 +806,11 @@ func ReadWorkerDefaults() (*configkit.Result[Config], error) {
|
||||
|
||||
### Paths and metadata
|
||||
|
||||
The path API, detached metadata records, and empty/unknown query behavior are now
|
||||
implemented; [`path.go`](../../path.go), [`records.go`](../../records.go), and
|
||||
[`metadata.go`](../../metadata.go) own their current Go contracts. Populating
|
||||
effective presence, origins, and history belongs to the loading stages. Callback
|
||||
path checking and safe historical values remain target behavior below.
|
||||
The path API, detached metadata records, empty/unknown query behavior, and
|
||||
base/default population are now implemented; [`path.go`](../../path.go),
|
||||
[`records.go`](../../records.go), [`metadata.go`](../../metadata.go), and the
|
||||
[metadata configuration contract](../config.md#base-default-metadata) own current
|
||||
behavior. Layered callback history and safe historical values remain target behavior.
|
||||
|
||||
### Resolution and validation callbacks
|
||||
|
||||
@@ -970,6 +981,12 @@ potentially sensitive configured values.
|
||||
|
||||
### Schema checking and secret classification
|
||||
|
||||
`VersionRule`, `Version`, and the version-checking use of `Validation` are
|
||||
implemented. The [current version contract](../config.md#application-schema-versions)
|
||||
owns absent/null/string handling, report locations, warnings, failure behavior, and
|
||||
raw-error suppression. Secret classification and later composed-source placement
|
||||
checks remain target work.
|
||||
|
||||
```go
|
||||
type VersionRule struct {
|
||||
Path Path
|
||||
@@ -1030,6 +1047,12 @@ applications own secret-producing transformations not described by those records
|
||||
|
||||
### Results, errors, and inspection
|
||||
|
||||
`Result.Config`, `Metadata`, `Sources`, and `Diagnostics`, together with
|
||||
`LoadError` and `WriteDiagnostics`, are implemented at the single-source boundary.
|
||||
The [current loading contract](../config.md#single-source-loading) and Go reference
|
||||
comments own their behavior. Effective rendering and richer layered inspection
|
||||
below remain target work.
|
||||
|
||||
```go
|
||||
type Result[T any] struct {
|
||||
Config T
|
||||
|
||||
Reference in New Issue
Block a user