Prepare scene extraction and deterministic normalization in core
This commit is contained in:
@@ -37,25 +37,25 @@ func (n *Normalizer) Key() string { return Key }
|
||||
|
||||
func (n *Normalizer) ReferenceSlots() []contracts.ReferenceSlot { return nil }
|
||||
|
||||
func (n *Normalizer) Normalize(ctx context.Context, req contracts.TypedNormalizeRequest[dnd.SceneDescriptionList]) (contracts.TypedNormalizeResult[dnd.SceneDescriptionList], error) {
|
||||
func (n *Normalizer) PrepareNormalize(ctx context.Context, req contracts.NormalizeInput[dnd.SceneDescriptionList]) (contracts.PreparedOperation[dnd.SceneDescriptionList], error) {
|
||||
if n == nil {
|
||||
return contracts.TypedNormalizeResult[dnd.SceneDescriptionList]{}, normalizerErrorf("normalizer must not be nil")
|
||||
return nil, normalizerErrorf("normalizer must not be nil")
|
||||
}
|
||||
if ctx == nil {
|
||||
return contracts.TypedNormalizeResult[dnd.SceneDescriptionList]{}, normalizerErrorf("context must not be nil")
|
||||
return nil, normalizerErrorf("context must not be nil")
|
||||
}
|
||||
if err := ctx.Err(); err != nil {
|
||||
return contracts.TypedNormalizeResult[dnd.SceneDescriptionList]{}, normalizerErrorf("context error before normalize: %w", err)
|
||||
return nil, normalizerErrorf("context error before normalize: %w", err)
|
||||
}
|
||||
value, findings, err := normalizeList(req.MergeOutput.Value, req.Source)
|
||||
if err != nil {
|
||||
return contracts.TypedNormalizeResult[dnd.SceneDescriptionList]{}, normalizerErrorf("normalize scenes: %w", err)
|
||||
return nil, normalizerErrorf("normalize scenes: %w", err)
|
||||
}
|
||||
diagnosticGroups, err := diagnostics.NormalizationDiagnostics(findings)
|
||||
if err != nil {
|
||||
return contracts.TypedNormalizeResult[dnd.SceneDescriptionList]{}, normalizerErrorf("collect diagnostics: %w", err)
|
||||
return nil, normalizerErrorf("collect diagnostics: %w", err)
|
||||
}
|
||||
return contracts.TypedNormalizeResult[dnd.SceneDescriptionList]{Value: value, Diagnostics: diagnosticGroups}, nil
|
||||
return contracts.DeterministicOperation[dnd.SceneDescriptionList]{Evaluation: contracts.CandidateEvaluation[dnd.SceneDescriptionList]{Result: contracts.EvaluationView[dnd.SceneDescriptionList]{Candidate: &value, Diagnostics: diagnosticGroups}}}, nil
|
||||
}
|
||||
|
||||
type normalizedScene struct {
|
||||
|
||||
Reference in New Issue
Block a user