Reuse indexes for D&D citation validation

This commit is contained in:
2026-07-25 12:53:48 +00:00
parent 9d1356a20e
commit 7a66095912
7 changed files with 55 additions and 21 deletions

View File

@@ -36,9 +36,13 @@ func (v *Validator) Validate(_ context.Context, req contracts.TypedValidationReq
if err := spellshape.Validate(req.Value); err != nil {
return contracts.ValidationResult{Approved: true}, nil
}
resolver, err := shared.NewCitationResolver(req.Source)
if err != nil {
return contracts.ValidationResult{Approved: true}, nil
}
citedTexts := make([]string, len(req.Value.SpellCasts))
for spellIndex, spell := range req.Value.SpellCasts {
citedText, err := shared.CitedText(req.Source, spell.SourceRefs)
citedText, err := resolver.CitedText(spell.SourceRefs)
if err != nil {
return contracts.ValidationResult{Approved: true}, nil
}