Integrate history prefixes into load handoffs
This commit is contained in:
@@ -12,6 +12,7 @@ type resolvedLoad[T any] struct {
|
||||
configuration T
|
||||
decoded decodedConfiguration
|
||||
metadata Metadata
|
||||
historyBuilder *historyBuilder
|
||||
final *document.Node
|
||||
snapshots []resolutionSnapshot
|
||||
applications []historyApplication
|
||||
@@ -56,9 +57,14 @@ func resolveLoadInput[T any](schema *schemaDescriptor, definition Definition[T],
|
||||
decoded := prepared.decoded
|
||||
configuration := decoded.value.Interface().(T)
|
||||
metadata := prepared.metadata
|
||||
builder := prepared.historyBuilder
|
||||
if builder == nil {
|
||||
builder = metadata.historyBuilder
|
||||
}
|
||||
final := decoded.final
|
||||
referenceInput := prepared.referenceInput
|
||||
var resolutionSnapshots []resolutionSnapshot
|
||||
refreshReferenceInput := false
|
||||
if definition.Resolve != nil {
|
||||
resolved := runResolution(&configuration, definition.Resolve, schema, decoded, referenceInput, prepared.resolution)
|
||||
diagnostics = append(diagnostics, resolved.diagnostics...)
|
||||
@@ -67,7 +73,18 @@ func resolveLoadInput[T any](schema *schemaDescriptor, definition Definition[T],
|
||||
}
|
||||
final = resolved.final
|
||||
resolutionSnapshots = resolved.snapshots
|
||||
if builder != nil && len(resolutionSnapshots) != 0 {
|
||||
builder.observeResolutionEvidence(resolutionSnapshots)
|
||||
}
|
||||
applyResolutionMetadata(&metadata, resolved, prepared.resolution)
|
||||
finalizeEffectiveMetadataPaths(&metadata, final)
|
||||
refreshReferenceInput = true
|
||||
}
|
||||
if builder != nil {
|
||||
builder.model.final = final
|
||||
builder.registerDocumentRoot(final)
|
||||
}
|
||||
if refreshReferenceInput {
|
||||
referenceInput = documentWithMetadataLocations(final, metadata, input.document)
|
||||
}
|
||||
applications := []historyApplication(nil)
|
||||
@@ -81,7 +98,7 @@ func resolveLoadInput[T any](schema *schemaDescriptor, definition Definition[T],
|
||||
versionEvidence = append(versionEvidence, input.versionState.evidence...)
|
||||
}
|
||||
return resolvedLoad[T]{
|
||||
configuration: configuration, decoded: decoded, metadata: metadata, final: final,
|
||||
configuration: configuration, decoded: decoded, metadata: metadata, historyBuilder: builder, final: final,
|
||||
snapshots: resolutionSnapshots, applications: applications,
|
||||
postDecodeApps: prepared.postDecodeApps, structuralInput: document.Clone(prepared.structuralInput),
|
||||
preCLI: prepared.preCLI, preCLIOrigins: prepared.preCLIOrigins, referenceInput: referenceInput,
|
||||
@@ -101,6 +118,9 @@ func detachLoadConfiguration[T any](schema *schemaDescriptor, configuration T, m
|
||||
|
||||
func prepareInspectionHistory[T any](resolved resolvedLoad[T], counter *retainedNodeCounter) (*Inspection, bool) {
|
||||
metadata := resolved.metadata
|
||||
if resolved.historyBuilder != nil {
|
||||
metadata.historyBuilder = resolved.historyBuilder
|
||||
}
|
||||
metadata.inheritance = nil
|
||||
inspection := &Inspection{
|
||||
metadata: metadata,
|
||||
|
||||
Reference in New Issue
Block a user