The Prototypical Clone
Duplicating complex entities by referencing a source of truth.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Prototype
ARCANUM SCHOOL: Conjuration // Replication
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
type SpellScroll {
id: ID!
incantation: String!
potency: Int!
creator: String!
}
input CloneScrollInput {
sourceId: ID!
# Optional overrides for the clone
newPotency: Int
newCreator: String
}
type Mutation {
# The Prototype pattern: copy an existing entity
duplicateScroll(input: CloneScrollInput!): SpellScroll!
}
The Prototype pattern in GraphQL involves mutations that take an existing entity’s ID and replicate its state. By providing a sourceId and optional overrides, the Oracle copies the arcane data without the client needing to read and re-write every field.
Runic Tags:
#graphql
#mutations
#replication
#creational
#prototype