Preserve selected collections in materialized references

This commit is contained in:
2026-11-29 17:59:01 +00:00
parent 10221b0624
commit d406aa6cd2
33 changed files with 251 additions and 2 deletions

View File

@@ -1,6 +1,31 @@
package shared
import "gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
import (
"fmt"
"sort"
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
)
// ValidateReferenceSelections rejects collection metadata on non-glossary inputs.
func ValidateReferenceSelections(references contracts.ReferenceSet) error {
names := make([]string, 0, len(references.Slots))
for name := range references.Slots {
names = append(names, name)
}
sort.Strings(names)
for _, name := range names {
if name == "glossary" || name == "spell_catalog" {
continue
}
for _, item := range references.Slots[name].Items {
if item.Collections != nil {
return fmt.Errorf("reference slot %q does not support collection selection", name)
}
}
}
return nil
}
type ReferenceSlotDescriptions struct {
Glossary string