⚙️ JSONNET RUNE DIFFICULTY: Apprentice Structural

The Adapter of Jsonnet

Translating one data schema into another.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Adapter
ARCANUM SCHOOL: Transmutation // Schema Shifting
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// JSONNET PATTERN //
local OldSystemData = {
  user_id: 123,
  full_name: "John Doe"
};

local Adapter(oldData) = {
  id: oldData.user_id,
  firstName: std.split(oldData.full_name, " ")[0],
  lastName: std.split(oldData.full_name, " ")[1]
};

{
  modern_system: Adapter(OldSystemData)
}

The Adapter acts as a magical translator, reshaping an archaic data layout into a modern schema, ensuring compatibility between disparate systems.

Runic Tags: #structural #adapter #jsonnet