diff --git a/src/GameCult.Mesh/CultMeshPrimitives.cs b/src/GameCult.Mesh/CultMeshPrimitives.cs
index 70ab2737..f45a9ae8 100644
--- a/src/GameCult.Mesh/CultMeshPrimitives.cs
+++ b/src/GameCult.Mesh/CultMeshPrimitives.cs
@@ -892,6 +892,9 @@ namespace GameCult.Mesh
/// Gets the stable CultCache schema version.
string SchemaVersion { get; }
+ /// Gets the content-derived schema identifier.
+ string SchemaId { get; }
+
/// Gets the preferred or observed route for document access.
CultMeshRouteHint RouteHint { get; }
@@ -1577,6 +1580,8 @@ namespace GameCult.Mesh
foreach (var document in documentList)
{
byType[document.DocumentType] = document;
+ if (!string.IsNullOrWhiteSpace(document.SchemaId))
+ bySchema[document.SchemaId] = document;
if (!string.IsNullOrWhiteSpace(document.SchemaVersion))
bySchema[document.SchemaVersion] = document;
if (!string.IsNullOrWhiteSpace(document.SchemaName))
@@ -1591,7 +1596,7 @@ namespace GameCult.Mesh
/// Gets the handles in this catalog.
public IReadOnlyList Documents => _documents;
- /// Looks up a document handle by shared schema name or schema version.
+ /// Looks up a document handle by schema id, shared schema name, or schema version.
public bool TryGetDocumentBySchema(
string schema,
out ICultMeshDocumentHandle document)
@@ -1606,7 +1611,7 @@ namespace GameCult.Mesh
return false;
}
- /// Looks up a document handle by shared schema name or schema version.
+ /// Looks up a document handle by schema id, shared schema name, or schema version.
public ICultMeshDocumentHandle DocumentBySchema(string schema)
{
if (TryGetDocumentBySchema(schema, out var document))
diff --git a/tests/GameCult.Mesh.Tests/CultMeshStreamingTests.cs b/tests/GameCult.Mesh.Tests/CultMeshStreamingTests.cs
index 205789a9..3d4e3c04 100644
--- a/tests/GameCult.Mesh.Tests/CultMeshStreamingTests.cs
+++ b/tests/GameCult.Mesh.Tests/CultMeshStreamingTests.cs
@@ -724,6 +724,9 @@ public sealed class CultMeshStreamingTests
catalog.TryGetDocumentBySchema("tests.mesh_note.v1", out var byVersion).Should().BeTrue();
byVersion.Should().BeSameAs(handle);
catalog.DocumentBySchema("tests.mesh_note").Should().BeSameAs(handle);
+ catalog.DocumentBySchema(CultDocumentRegistry.Shared.GetRequired().SchemaId)
+ .Should()
+ .BeSameAs(handle);
catalog.TryGetDocument(out var alias).Should().BeTrue();
alias.DocumentId.Should().Be(handle.DocumentId);