Document shared source version checks

This commit is contained in:
2026-10-15 16:23:39 +00:00
parent 358b28c421
commit 020d72084d
12 changed files with 165 additions and 38 deletions

View File

@@ -18,7 +18,10 @@ type Definition[T any] struct {
}
// SourceVersionMode controls schema-version declarations across one complete
// load. The zero value preserves the existing effective-path version check.
// load. The zero value preserves the existing main-only effective-path check
// and its protected-path behavior. Enabled modes check participating documents
// at source-local Definition.Version.Path coordinates and consume accepted
// non-main declarations. See the shared source-version contract in docs/config.md.
type SourceVersionMode uint8
const (
@@ -77,7 +80,10 @@ type Override struct {
type Resolution struct{ value *engine.Resolution }
// VersionRule declares the input path and application checker for a schema version.
// At that path, string and decimal-integer input is supplied as Version.Text.
// Default source-version mode interprets Path as the existing effective path;
// enabled modes interpret it in each participating document's local coordinates.
// At the selected path, strings and strict decimal integers supply their exact
// spelling as Version.Text. See docs/config.md for the complete contract.
type VersionRule struct {
Path Path
Check func(Version, *Validation) error