Skip to content

Commit 36ded53

Browse files
committed
feat(csharp): C4 metamodelVersion marker in the registry manifest
Emit `metamodelVersion: "0"` as the first top-level key in the C# registry manifest, mirroring the TS reference. Byte-matches the shared fixture `fixtures/registry-conformance/expected-registry.json`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GF9xLEQZaPus5Y6opk398n
1 parent a1277b5 commit 36ded53

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

server/csharp/MetaObjects/RegistryManifest.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,15 +369,23 @@ private static ManifestType ToManifestType(TypeDefinition def) =>
369369
// Emit
370370
// ------------------------------------------------------------------
371371

372+
/// <summary>
373+
/// The rolled-up metamodel spec-version string. Value <c>"0"</c> = pre-1.0 /
374+
/// unstable (semver major-0). The 1.0 cut flips this to <c>"1.0"</c>.
375+
/// Emitted as the FIRST top-level key in the registry manifest (C4).
376+
/// </summary>
377+
public const string MetamodelVersion = "0";
378+
372379
/// <summary>
373380
/// Emit the canonical registry manifest as a byte-stable JSON string.
374381
///
375382
/// Serialization contract — every port MUST match this exactly:
376383
/// - 2-space indentation.
377-
/// - Object key order fixed by construction: <c>types</c>, <c>commonAttrs</c>,
378-
/// <c>defaultSubTypes</c>; each type as <c>type</c>, <c>subType</c>, <c>attrs</c>;
379-
/// each attr as <c>name</c>, <c>valueType</c>, <c>isArray</c>, <c>required</c>,
380-
/// optional <c>allowedValues</c> (ADR-0036 Wave 1; only-when-closed), <c>description</c>.
384+
/// - Object key order fixed by construction: <c>metamodelVersion</c> (first),
385+
/// <c>types</c>, <c>commonAttrs</c>, <c>defaultSubTypes</c>; each type as
386+
/// <c>type</c>, <c>subType</c>, <c>attrs</c>; each attr as <c>name</c>,
387+
/// <c>valueType</c>, <c>isArray</c>, <c>required</c>, optional
388+
/// <c>allowedValues</c> (ADR-0036 Wave 1; only-when-closed), <c>description</c>.
381389
/// - All arrays sorted (ordinal/ASCII): types by "type.subType"; attrs by name;
382390
/// commonAttrs by name; defaultSubTypes keys sorted.
383391
/// - <c>valueType: null</c> literal for polymorphic/untyped attrs.
@@ -403,6 +411,9 @@ public static string Emit(TypeRegistry registry)
403411
{
404412
writer.WriteStartObject();
405413

414+
// metamodelVersion — FIRST key (C4: rolled-up spec-version marker)
415+
writer.WriteString("metamodelVersion", MetamodelVersion);
416+
406417
// types
407418
writer.WriteStartArray("types");
408419
foreach (ManifestType t in types)

0 commit comments

Comments
 (0)