An order model grows
A class diff. The domain model gains a Discount class and its relation, and a cardinality and two members change.






┌────────────────────┐
│ Customer │
├────────────────────┤
│ - name: string │
│ - email: string │
└────────────────────┘
places ◇ 1 ◆ 1
│ │
┌─────────┘ └─────────┐ ships to
│ * │ 0..*
┌────────────────────┐ ┌────────────────────┐
│ Order │ │ Address │
├────────────────────┤ ├────────────────────┤
│ - id: string │ │ - street: string │
│ - placedAt: Date │ │ - city: string │
├────────────────────┤ └────────────────────┘
│ + total(): Money │
└────────────────────┘
contains ◆ 1 ◆ 1 ◇ 1
│ │ │
┌─────────────────────┘ │ └───────────────────────┐ applies
│ 1..* settled by │ 1 │ 0..*
┌────────────────────┐ ┌────────────────────┐ ┌────────────────────────┐
│ ~ LineItem │ │ ~ Payment │ │ + Discount │
├────────────────────┤ ├────────────────────┤ ├────────────────────────┤
│ - quantity: int │ │ - method: string │ │ - code: string │
│ ~ + price: Money │ │ - - amount: Money │ │ - percentOff: number │
└────────────────────┘ └────────────────────┘ └────────────────────────┘
│ *
│ references
│ 1
┌──────────────────┐
│ Product │
├──────────────────┤
│ - sku: string │
│ - name: string │
└──────────────────┘
class-domain.json → class-domain-v2.json
added: class Discount
added: relation Order -> Discount
changed: relation Customer -> Address: to_card "1..*" → "0..*"
changed: class LineItem, changed attribute + price: Money
changed: class Payment, removed attribute - amount: Money




Spec
{ "type": "class", "theme": "default", "legend": true, "classes": [ { "id": "order", "label": "Order", "attributes": [ {"visibility": "-", "text": "id: string"}, {"visibility": "-", "text": "placedAt: Date"} ], "methods": [{"visibility": "+", "text": "total(): Money"}] }, { "id": "item", "label": "LineItem", "attributes": [ {"visibility": "-", "text": "quantity: int"}, {"visibility": "-", "text": "price: Money"} ] }, { "id": "product", "label": "Product", "attributes": [ {"visibility": "-", "text": "sku: string"}, {"visibility": "-", "text": "name: string"} ] }, { "id": "customer", "label": "Customer", "attributes": [ {"visibility": "-", "text": "name: string"}, {"visibility": "-", "text": "email: string"} ] }, { "id": "address", "label": "Address", "attributes": [ {"visibility": "-", "text": "street: string"}, {"visibility": "-", "text": "city: string"} ] }, { "id": "payment", "label": "Payment", "attributes": [ {"visibility": "-", "text": "method: string"}, {"visibility": "-", "text": "amount: Money"} ] } ], "relations": [ { "id": "contains", "from": "order", "to": "item", "kind": "composition", "from_card": "1", "to_card": "1..*", "label": "contains" }, { "id": "references", "from": "item", "to": "product", "kind": "association", "from_card": "*", "to_card": "1", "label": "references" }, { "id": "places", "from": "customer", "to": "order", "kind": "aggregation", "from_card": "1", "to_card": "*", "label": "places" }, { "id": "ships-to", "from": "customer", "to": "address", "kind": "composition", "from_card": "1", "to_card": "1..*", "label": "ships to" }, { "id": "settled-by", "from": "order", "to": "payment", "kind": "composition", "from_card": "1", "to_card": "1", "label": "settled by" } ]}{ "type": "class", "theme": "default", "legend": true, "classes": [ { "id": "order", "label": "Order", "attributes": [ {"visibility": "-", "text": "id: string"}, {"visibility": "-", "text": "placedAt: Date"} ], "methods": [{"visibility": "+", "text": "total(): Money"}] }, { "id": "item", "label": "LineItem", "attributes": [ {"visibility": "-", "text": "quantity: int"}, {"visibility": "+", "text": "price: Money"} ] }, { "id": "product", "label": "Product", "attributes": [ {"visibility": "-", "text": "sku: string"}, {"visibility": "-", "text": "name: string"} ] }, { "id": "customer", "label": "Customer", "attributes": [ {"visibility": "-", "text": "name: string"}, {"visibility": "-", "text": "email: string"} ] }, { "id": "address", "label": "Address", "attributes": [ {"visibility": "-", "text": "street: string"}, {"visibility": "-", "text": "city: string"} ] }, { "id": "payment", "label": "Payment", "attributes": [{"visibility": "-", "text": "method: string"}] }, { "id": "discount", "label": "Discount", "attributes": [ {"visibility": "-", "text": "code: string"}, {"visibility": "-", "text": "percentOff: number"} ] } ], "relations": [ { "id": "contains", "from": "order", "to": "item", "kind": "composition", "from_card": "1", "to_card": "1..*", "label": "contains" }, { "id": "references", "from": "item", "to": "product", "kind": "association", "from_card": "*", "to_card": "1", "label": "references" }, { "id": "places", "from": "customer", "to": "order", "kind": "aggregation", "from_card": "1", "to_card": "*", "label": "places" }, { "id": "ships-to", "from": "customer", "to": "address", "kind": "composition", "from_card": "1", "to_card": "0..*", "label": "ships to" }, { "id": "settled-by", "from": "order", "to": "payment", "kind": "composition", "from_card": "1", "to_card": "1", "label": "settled by" }, { "id": "applies", "from": "order", "to": "discount", "kind": "aggregation", "from_card": "1", "to_card": "0..*", "label": "applies" } ]}Draw it yourself
diago diff domain-change.v1.json domain-change.v2.json > domain-change.diff.svgOpen it in the playground to edit it in your browser.