Add D&D location extractor

This commit is contained in:
2026-08-04 00:02:18 +00:00
parent c51934d5c6
commit bb4855f0c6
15 changed files with 762 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
package locations
import (
"encoding/json"
"strings"
"testing"
)
func TestLocationResponseSchemaIsPrivateAndStructural(t *testing.T) {
schema, err := loadResponseSchema()
if err != nil {
t.Fatalf("loadResponseSchema() error = %v", err)
}
if schema.Key != ResponseSchemaKey || schema.ID != ResponseSchemaID || schema.Name != ResponseSchemaName || schema.Version != SchemaVersion || !strings.HasPrefix(schema.SHA256, "sha256:") || !json.Valid(schema.JSONSchema) {
t.Fatalf("schema = %#v, want location response schema", schema)
}
var document map[string]any
if err := json.Unmarshal(schema.JSONSchema, &document); err != nil {
t.Fatal(err)
}
encoded, err := json.Marshal(document)
if err != nil || strings.Contains(string(encoded), `"id"`) {
t.Fatalf("schema = %s, want no durable ID field", encoded)
}
}