Use entry metadata for resolution presence
This commit is contained in:
@@ -13,7 +13,6 @@ const closedCallbackContextMessage = "configkit: callback context is no longer a
|
||||
type resolutionState struct {
|
||||
active bool
|
||||
schema *schemaDescriptor
|
||||
presence map[string]inputPresence
|
||||
document *document.Node
|
||||
input resolutionInput
|
||||
records map[string]*resolutionRecord
|
||||
@@ -78,8 +77,12 @@ func (r *Resolution) IsExplicit(path Path) bool {
|
||||
if !state.validPath(path) {
|
||||
return false
|
||||
}
|
||||
_, explicit := state.presence[path.String()]
|
||||
return explicit
|
||||
return state.inputExplicit(path)
|
||||
}
|
||||
|
||||
func (state *resolutionState) inputExplicit(path Path) bool {
|
||||
info, found := state.input.lookup(path)
|
||||
return found && info.Explicit
|
||||
}
|
||||
|
||||
// InputInfo returns detached entry-state metadata for path. The entry state is
|
||||
@@ -134,7 +137,7 @@ func Default[V any](resolution *Resolution, path Path, target *V, value V, reaso
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if _, explicit := state.presence[path.String()]; explicit {
|
||||
if state.inputExplicit(path) {
|
||||
return
|
||||
}
|
||||
*target = value
|
||||
@@ -282,7 +285,7 @@ func (state *resolutionState) addDiagnostic(code Code, path Path, message string
|
||||
|
||||
func runResolution[T any](configuration *T, resolver func(*T, *Resolution) error, schema *schemaDescriptor, decoded decodedConfiguration, input *document.Node, entry resolutionInput) resolutionResult {
|
||||
state := &resolutionState{
|
||||
active: true, schema: schema, presence: decoded.presence, document: input,
|
||||
active: true, schema: schema, document: input,
|
||||
input: entry,
|
||||
records: make(map[string]*resolutionRecord),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user