D2 DeploymentDiagram Spec¶
Source: d2.deployment-diagram.json
This schema describes the DeploymentDiagram spec for the D2 backend.
Properties¶
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Type of the diagram. Must be exactly DeploymentDiagram. |
title |
string | null |
Optional diagram title. |
elements |
array[Element] |
Top-level elements. |
boundaries |
array[Boundary] |
Top-level boundaries. |
relationships |
array[D2RelationshipSchema] |
Top-level relationships. |
render_options |
D2RenderOptionsSchema |
D2-specific render options. |
backend(required) |
string |
JSON schema backend. Must be exactly d2. |
Examples
JSON source
{
"backend": "d2",
"type": "DeploymentDiagram",
"title": "Web App Deployment",
"elements": [
{
"type": "Person",
"alias": "user",
"label": "User",
"description": "Uses the web application."
}
],
"boundaries": [
{
"type": "DeploymentNode",
"alias": "web_node",
"label": "Web Server",
"description": "Hosts the frontend application.",
"elements": [
{
"type": "Container",
"alias": "web_app",
"label": "Web App",
"description": "Customer-facing web application.",
"technology": "Next.js"
}
]
},
{
"type": "DeploymentNode",
"alias": "db_node",
"label": "Database Server",
"description": "Hosts the application database.",
"elements": [
{
"type": "ContainerDb",
"alias": "app_db",
"label": "App Database",
"description": "Stores application data.",
"technology": "PostgreSQL"
}
]
}
],
"relationships": [
{
"type": "REL",
"from": "user",
"to": "web_app",
"label": "Uses",
"technology": "HTTPS"
},
{
"type": "REL",
"from": "web_app",
"to": "app_db",
"label": "Reads and writes",
"technology": "TLS / SQL"
}
]
}
Rendered D2 source
direction: right
__title: ||md
# Web App Deployment
|| {
near: top-center
}
classes: {
c4_person: {
style.fill: "#f5f1ff"
style.stroke: "#6f4bb2"
style.font-color: "#211436"
}
c4_database: {
style.fill: "#edf7ff"
style.stroke: "#2d6f9f"
}
}
user: ||md
## User
[Person]
Uses the web application.
|| {
shape: c4-person
class: ["c4_person"]
}
web_node: {
label: ||md
## Web Server
[Boundary]
Hosts the frontend application.
||
shape: rectangle
web_app: ||md
## Web App
[Container: Next.js]
Customer-facing web application.
|| {
shape: rectangle
}
}
db_node: {
label: ||md
## Database Server
[Boundary]
Hosts the application database.
||
shape: rectangle
app_db: ||md
## App Database
[Container: PostgreSQL]
Stores application data.
|| {
shape: cylinder
class: ["c4_database"]
}
}
user -> web_node.web_app: "Uses\n[HTTPS]"
web_node.web_app -> db_node.app_db: "Reads and writes\n[TLS / SQL]"
Rendered image
JSON source
{
"backend": "d2",
"type": "DeploymentDiagram",
"title": "Online Shop - Production Deployment",
"elements": [
{
"type": "Person",
"alias": "customer",
"label": "Customer",
"description": "Uses the online shop through a browser.",
"properties": {
"properties": [
[
"Boundary",
"External"
],
[
"Protocol",
"HTTPS"
]
]
}
},
{
"type": "ContainerExt",
"alias": "payment_gateway",
"label": "Payment Gateway",
"description": "External service that processes card payments.",
"technology": "HTTPS API",
"properties": {
"properties": [
[
"Boundary",
"External"
],
[
"Protocol",
"HTTPS API"
]
]
}
}
],
"boundaries": [
{
"type": "Node",
"alias": "aws_prod",
"label": "AWS Production Account",
"description": "Production cloud account for the online shop.",
"properties": {
"properties": [
[
"Environment",
"Production"
],
[
"Region",
"eu-central-1"
]
]
},
"boundaries": [
{
"type": "Node",
"alias": "public_subnet",
"label": "Public Subnet",
"description": "Internet-facing network segment.",
"boundaries": [
{
"type": "DeploymentNode",
"alias": "alb",
"label": "Application Load Balancer",
"description": "Terminates TLS and routes requests to the web tier.",
"elements": [
{
"type": "Container",
"alias": "web_app",
"label": "Web Application",
"description": "Serves the storefront UI.",
"technology": "Next.js"
}
]
}
]
},
{
"type": "Node",
"alias": "private_subnet",
"label": "Private Subnet",
"description": "Internal network segment for application and data services.",
"boundaries": [
{
"type": "DeploymentNode",
"alias": "app_cluster",
"label": "Kubernetes Cluster",
"description": "Runs backend services and asynchronous workers.",
"properties": {
"properties": [
[
"Platform",
"EKS"
],
[
"Autoscaling",
"Enabled"
]
]
},
"elements": [
{
"type": "Container",
"alias": "backend_api",
"label": "Backend API",
"description": "Handles catalog, checkout, and order processing.",
"technology": "Python / FastAPI"
},
{
"type": "ContainerQueue",
"alias": "order_events",
"label": "Order Events",
"description": "Internal asynchronous event stream.",
"technology": "Kafka"
}
]
},
{
"type": "DeploymentNode",
"alias": "db_service",
"label": "Managed PostgreSQL",
"description": "Managed relational database service.",
"properties": {
"properties": [
[
"Service",
"RDS"
],
[
"Mode",
"Multi-AZ"
]
]
},
"elements": [
{
"type": "ContainerDb",
"alias": "orders_db",
"label": "Orders Database",
"description": "Stores orders, payments, and fulfillment data.",
"technology": "PostgreSQL"
}
]
}
]
}
]
}
],
"relationships": [
{
"type": "REL",
"from": "customer",
"to": "web_app",
"label": "Uses",
"technology": "HTTPS"
},
{
"type": "REL",
"from": "web_app",
"to": "backend_api",
"label": "Routes traffic to",
"technology": "HTTPS"
},
{
"type": "REL",
"from": "backend_api",
"to": "orders_db",
"label": "Reads and writes",
"technology": "TLS / SQL"
},
{
"type": "REL",
"from": "backend_api",
"to": "payment_gateway",
"label": "Calls",
"technology": "HTTPS/JSON"
},
{
"type": "REL",
"from": "backend_api",
"to": "order_events",
"label": "Publishes events to",
"technology": "Kafka"
}
],
"render_options": {
"layout": "dagre",
"include_properties": true,
"bidirectional_relationships": "single_edge"
}
}
Rendered D2 source
direction: right
__title: ||md
# Online Shop - Production Deployment
|| {
near: top-center
}
classes: {
c4_person: {
style.fill: "#f5f1ff"
style.stroke: "#6f4bb2"
style.font-color: "#211436"
}
c4_external: {
style.fill: "#f7f7f7"
style.stroke: "#767676"
style.stroke-dash: "5"
}
c4_database: {
style.fill: "#edf7ff"
style.stroke: "#2d6f9f"
}
c4_queue: {
style.fill: "#fff6e5"
style.stroke: "#9b6500"
}
}
customer: ||md
## Customer
[Person]
Uses the online shop through a browser.
| Property | Value |
| --- | --- |
| Boundary | External |
| Protocol | HTTPS |
|| {
shape: c4-person
class: ["c4_person"]
}
payment_gateway: ||md
## Payment Gateway
[Container: HTTPS API]
External service that processes card payments.
| Property | Value |
| --- | --- |
| Boundary | External |
| Protocol | HTTPS API |
|| {
shape: rectangle
class: ["c4_external"]
}
aws_prod: {
label: ||md
## AWS Production Account
[Boundary]
Production cloud account for the online shop.
||
shape: rectangle
public_subnet: {
label: ||md
## Public Subnet
[Boundary]
Internet-facing network segment.
||
shape: rectangle
alb: {
label: ||md
## Application Load Balancer
[Boundary]
Terminates TLS and routes requests to the web tier.
||
shape: rectangle
web_app: ||md
## Web Application
[Container: Next.js]
Serves the storefront UI.
|| {
shape: rectangle
}
}
}
private_subnet: {
label: ||md
## Private Subnet
[Boundary]
Internal network segment for application and data services.
||
shape: rectangle
app_cluster: {
label: ||md
## Kubernetes Cluster
[Boundary]
Runs backend services and asynchronous workers.
||
shape: rectangle
backend_api: ||md
## Backend API
[Container: Python / FastAPI]
Handles catalog, checkout, and order processing.
|| {
shape: rectangle
}
order_events: ||md
## Order Events
[Container: Kafka]
Internal asynchronous event stream.
|| {
shape: queue
class: ["c4_queue"]
}
}
db_service: {
label: ||md
## Managed PostgreSQL
[Boundary]
Managed relational database service.
||
shape: rectangle
orders_db: ||md
## Orders Database
[Container: PostgreSQL]
Stores orders, payments, and fulfillment data.
|| {
shape: cylinder
class: ["c4_database"]
}
}
}
}
customer -> aws_prod.public_subnet.alb.web_app: "Uses\n[HTTPS]"
aws_prod.public_subnet.alb.web_app -> aws_prod.private_subnet.app_cluster.backend_api: "Routes traffic to\n[HTTPS]"
aws_prod.private_subnet.app_cluster.backend_api -> aws_prod.private_subnet.db_service.orders_db: "Reads and writes\n[TLS / SQL]"
aws_prod.private_subnet.app_cluster.backend_api -> payment_gateway: "Calls\n[HTTPS/JSON]"
aws_prod.private_subnet.app_cluster.backend_api -> aws_prod.private_subnet.app_cluster.order_events: "Publishes events to\n[Kafka]"
Rendered image
Elements¶
- D2PersonSchema
- D2PersonExtSchema
- D2SystemSchema
- D2SystemExtSchema
- D2SystemDbSchema
- D2SystemDbExtSchema
- D2SystemQueueSchema
- D2SystemQueueExtSchema
- D2ContainerSchema
- D2ContainerExtSchema
- D2ContainerDbSchema
- D2ContainerDbExtSchema
- D2ContainerQueueSchema
- D2ContainerQueueExtSchema
Boundaries¶
Relationships¶
Definitions¶
About labels and aliases
label is a display name for the element.
alias is a unique identifier used for referencing elements
in relationships and layouts.
If omitted, it is generated automatically.
You can also use label for referencing elements in relationships and layouts, but each label must be unique within the diagram.
D2ContainerDbExtSchema¶
D2 JSON schema for an external database-like container.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Discriminator identifying the element type. Must be exactly ContainerDbExt. |
alias |
string | null |
Unique identifier for the element. If not provided, it is autogenerated from the label. |
classes |
array[string] |
Optional D2 classes. |
description |
string | null |
Optional description text. |
direction |
enum[up | down | left | right] | null |
Optional D2 layout direction for a container. |
icon |
string | null |
Optional D2 icon URL. |
label(required) |
string |
Display name for the element. |
link |
string | null |
Optional D2 link URL. |
near |
string | null |
Optional D2 near reference. |
properties |
DiagramElementPropertiesSchema |
Optional property table metadata. |
shape |
string | null |
Optional D2 shape. |
style |
D2StyleSchema |
Optional D2 style attributes. |
technology |
string | null |
Optional technology. |
tooltip |
string | null |
Optional D2 tooltip. |
D2ContainerDbSchema¶
D2 JSON schema for a database-like container.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Discriminator identifying the element type. Must be exactly ContainerDb. |
alias |
string | null |
Unique identifier for the element. If not provided, it is autogenerated from the label. |
classes |
array[string] |
Optional D2 classes. |
description |
string | null |
Optional description text. |
direction |
enum[up | down | left | right] | null |
Optional D2 layout direction for a container. |
icon |
string | null |
Optional D2 icon URL. |
label(required) |
string |
Display name for the element. |
link |
string | null |
Optional D2 link URL. |
near |
string | null |
Optional D2 near reference. |
properties |
DiagramElementPropertiesSchema |
Optional property table metadata. |
shape |
string | null |
Optional D2 shape. |
style |
D2StyleSchema |
Optional D2 style attributes. |
technology |
string | null |
Optional technology. |
tooltip |
string | null |
Optional D2 tooltip. |
D2ContainerExtSchema¶
D2 JSON schema for an external container.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Discriminator identifying the element type. Must be exactly ContainerExt. |
alias |
string | null |
Unique identifier for the element. If not provided, it is autogenerated from the label. |
classes |
array[string] |
Optional D2 classes. |
description |
string | null |
Optional description text. |
direction |
enum[up | down | left | right] | null |
Optional D2 layout direction for a container. |
icon |
string | null |
Optional D2 icon URL. |
label(required) |
string |
Display name for the element. |
link |
string | null |
Optional D2 link URL. |
near |
string | null |
Optional D2 near reference. |
properties |
DiagramElementPropertiesSchema |
Optional property table metadata. |
shape |
string | null |
Optional D2 shape. |
style |
D2StyleSchema |
Optional D2 style attributes. |
technology |
string | null |
Optional technology. |
tooltip |
string | null |
Optional D2 tooltip. |
D2ContainerQueueExtSchema¶
D2 JSON schema for an external queue-like container.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Discriminator identifying the element type. Must be exactly ContainerQueueExt. |
alias |
string | null |
Unique identifier for the element. If not provided, it is autogenerated from the label. |
classes |
array[string] |
Optional D2 classes. |
description |
string | null |
Optional description text. |
direction |
enum[up | down | left | right] | null |
Optional D2 layout direction for a container. |
icon |
string | null |
Optional D2 icon URL. |
label(required) |
string |
Display name for the element. |
link |
string | null |
Optional D2 link URL. |
near |
string | null |
Optional D2 near reference. |
properties |
DiagramElementPropertiesSchema |
Optional property table metadata. |
shape |
string | null |
Optional D2 shape. |
style |
D2StyleSchema |
Optional D2 style attributes. |
technology |
string | null |
Optional technology. |
tooltip |
string | null |
Optional D2 tooltip. |
D2ContainerQueueSchema¶
D2 JSON schema for a queue-like container.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Discriminator identifying the element type. Must be exactly ContainerQueue. |
alias |
string | null |
Unique identifier for the element. If not provided, it is autogenerated from the label. |
classes |
array[string] |
Optional D2 classes. |
description |
string | null |
Optional description text. |
direction |
enum[up | down | left | right] | null |
Optional D2 layout direction for a container. |
icon |
string | null |
Optional D2 icon URL. |
label(required) |
string |
Display name for the element. |
link |
string | null |
Optional D2 link URL. |
near |
string | null |
Optional D2 near reference. |
properties |
DiagramElementPropertiesSchema |
Optional property table metadata. |
shape |
string | null |
Optional D2 shape. |
style |
D2StyleSchema |
Optional D2 style attributes. |
technology |
string | null |
Optional technology. |
tooltip |
string | null |
Optional D2 tooltip. |
D2ContainerSchema¶
D2 JSON schema for a container.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Discriminator identifying the element type. Must be exactly Container. |
alias |
string | null |
Unique identifier for the element. If not provided, it is autogenerated from the label. |
classes |
array[string] |
Optional D2 classes. |
description |
string | null |
Optional description text. |
direction |
enum[up | down | left | right] | null |
Optional D2 layout direction for a container. |
icon |
string | null |
Optional D2 icon URL. |
label(required) |
string |
Display name for the element. |
link |
string | null |
Optional D2 link URL. |
near |
string | null |
Optional D2 near reference. |
properties |
DiagramElementPropertiesSchema |
Optional property table metadata. |
shape |
string | null |
Optional D2 shape. |
style |
D2StyleSchema |
Optional D2 style attributes. |
technology |
string | null |
Optional technology. |
tooltip |
string | null |
Optional D2 tooltip. |
D2DeploymentNodeSchema¶
D2 JSON schema for a deployment-specific node.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Discriminator identifying the element type. Must be exactly DeploymentNode. |
elements |
array[Element] |
Top-level elements. |
boundaries |
array[Boundary] |
Top-level boundaries. |
relationships |
array[D2RelationshipSchema] |
Top-level relationships. |
alias |
string | null |
Unique identifier for the element. If not provided, it is autogenerated from the label. |
classes |
array[string] |
Optional D2 classes. |
description |
string | null |
Optional description text. |
direction |
enum[up | down | left | right] | null |
Optional D2 layout direction for a container. |
icon |
string | null |
Optional D2 icon URL. |
label(required) |
string |
Display name for the element. |
link |
string | null |
Optional D2 link URL. |
near |
string | null |
Optional D2 near reference. |
properties |
DiagramElementPropertiesSchema |
Optional property table metadata. |
shape |
string | null |
Optional D2 shape. |
style |
D2StyleSchema |
Optional D2 style attributes. |
tooltip |
string | null |
Optional D2 tooltip. |
D2NodeSchema¶
D2 JSON schema for a deployment node.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Discriminator identifying the element type. Must be exactly Node. |
elements |
array[Element] |
Top-level elements. |
boundaries |
array[Boundary] |
Top-level boundaries. |
relationships |
array[D2RelationshipSchema] |
Top-level relationships. |
alias |
string | null |
Unique identifier for the element. If not provided, it is autogenerated from the label. |
classes |
array[string] |
Optional D2 classes. |
description |
string | null |
Optional description text. |
direction |
enum[up | down | left | right] | null |
Optional D2 layout direction for a container. |
icon |
string | null |
Optional D2 icon URL. |
label(required) |
string |
Display name for the element. |
link |
string | null |
Optional D2 link URL. |
near |
string | null |
Optional D2 near reference. |
properties |
DiagramElementPropertiesSchema |
Optional property table metadata. |
shape |
string | null |
Optional D2 shape. |
style |
D2StyleSchema |
Optional D2 style attributes. |
tooltip |
string | null |
Optional D2 tooltip. |
D2PersonExtSchema¶
D2 JSON schema for an external person.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Discriminator identifying the element type. Must be exactly PersonExt. |
alias |
string | null |
Unique identifier for the element. If not provided, it is autogenerated from the label. |
classes |
array[string] |
Optional D2 classes. |
description |
string | null |
Optional description text. |
direction |
enum[up | down | left | right] | null |
Optional D2 layout direction for a container. |
icon |
string | null |
Optional D2 icon URL. |
label(required) |
string |
Display name for the element. |
link |
string | null |
Optional D2 link URL. |
near |
string | null |
Optional D2 near reference. |
properties |
DiagramElementPropertiesSchema |
Optional property table metadata. |
shape |
string | null |
Optional D2 shape. |
style |
D2StyleSchema |
Optional D2 style attributes. |
tooltip |
string | null |
Optional D2 tooltip. |
D2PersonSchema¶
D2 JSON schema for a person.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Discriminator identifying the element type. Must be exactly Person. |
alias |
string | null |
Unique identifier for the element. If not provided, it is autogenerated from the label. |
classes |
array[string] |
Optional D2 classes. |
description |
string | null |
Optional description text. |
direction |
enum[up | down | left | right] | null |
Optional D2 layout direction for a container. |
icon |
string | null |
Optional D2 icon URL. |
label(required) |
string |
Display name for the element. |
link |
string | null |
Optional D2 link URL. |
near |
string | null |
Optional D2 near reference. |
properties |
DiagramElementPropertiesSchema |
Optional property table metadata. |
shape |
string | null |
Optional D2 shape. |
style |
D2StyleSchema |
Optional D2 style attributes. |
tooltip |
string | null |
Optional D2 tooltip. |
D2RelationshipSchema¶
JSON schema for relationships supported by D2 C4 diagrams.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
RelationshipType |
Type of the relationship. |
classes |
array[string] |
Optional D2 classes. |
description |
string | null |
Additional details about the relationship. |
from(required) |
string |
The source element alias (or unique label). |
icon |
string | null |
Optional D2 icon URL. |
label(required) |
string |
The label shown on the relationship edge. |
link |
string | null |
Optional D2 link URL. |
near |
string | null |
Optional D2 near reference. |
properties |
DiagramElementPropertiesSchema |
Optional property table metadata. |
style |
D2StyleSchema |
Optional D2 style attributes. |
technology |
string | null |
The technology used in the communication. |
to(required) |
string |
The destination element alias (or unique label). |
tooltip |
string | null |
Optional D2 tooltip. |
RelationshipType¶
Relationship types supported by D2 C4 diagrams.
Items
| Type | Description |
|---|---|
BI_REL |
A bidirectional relationship between two elements. |
REL |
A unidirectional relationship between two elements. |
D2SystemDbExtSchema¶
D2 JSON schema for an external database-like system.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Discriminator identifying the element type. Must be exactly SystemDbExt. |
alias |
string | null |
Unique identifier for the element. If not provided, it is autogenerated from the label. |
classes |
array[string] |
Optional D2 classes. |
description |
string | null |
Optional description text. |
direction |
enum[up | down | left | right] | null |
Optional D2 layout direction for a container. |
icon |
string | null |
Optional D2 icon URL. |
label(required) |
string |
Display name for the element. |
link |
string | null |
Optional D2 link URL. |
near |
string | null |
Optional D2 near reference. |
properties |
DiagramElementPropertiesSchema |
Optional property table metadata. |
shape |
string | null |
Optional D2 shape. |
style |
D2StyleSchema |
Optional D2 style attributes. |
tooltip |
string | null |
Optional D2 tooltip. |
D2SystemDbSchema¶
D2 JSON schema for a database-like system.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Discriminator identifying the element type. Must be exactly SystemDb. |
alias |
string | null |
Unique identifier for the element. If not provided, it is autogenerated from the label. |
classes |
array[string] |
Optional D2 classes. |
description |
string | null |
Optional description text. |
direction |
enum[up | down | left | right] | null |
Optional D2 layout direction for a container. |
icon |
string | null |
Optional D2 icon URL. |
label(required) |
string |
Display name for the element. |
link |
string | null |
Optional D2 link URL. |
near |
string | null |
Optional D2 near reference. |
properties |
DiagramElementPropertiesSchema |
Optional property table metadata. |
shape |
string | null |
Optional D2 shape. |
style |
D2StyleSchema |
Optional D2 style attributes. |
tooltip |
string | null |
Optional D2 tooltip. |
D2SystemExtSchema¶
D2 JSON schema for an external software system.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Discriminator identifying the element type. Must be exactly SystemExt. |
alias |
string | null |
Unique identifier for the element. If not provided, it is autogenerated from the label. |
classes |
array[string] |
Optional D2 classes. |
description |
string | null |
Optional description text. |
direction |
enum[up | down | left | right] | null |
Optional D2 layout direction for a container. |
icon |
string | null |
Optional D2 icon URL. |
label(required) |
string |
Display name for the element. |
link |
string | null |
Optional D2 link URL. |
near |
string | null |
Optional D2 near reference. |
properties |
DiagramElementPropertiesSchema |
Optional property table metadata. |
shape |
string | null |
Optional D2 shape. |
style |
D2StyleSchema |
Optional D2 style attributes. |
tooltip |
string | null |
Optional D2 tooltip. |
D2SystemQueueExtSchema¶
D2 JSON schema for an external queue-like system.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Discriminator identifying the element type. Must be exactly SystemQueueExt. |
alias |
string | null |
Unique identifier for the element. If not provided, it is autogenerated from the label. |
classes |
array[string] |
Optional D2 classes. |
description |
string | null |
Optional description text. |
direction |
enum[up | down | left | right] | null |
Optional D2 layout direction for a container. |
icon |
string | null |
Optional D2 icon URL. |
label(required) |
string |
Display name for the element. |
link |
string | null |
Optional D2 link URL. |
near |
string | null |
Optional D2 near reference. |
properties |
DiagramElementPropertiesSchema |
Optional property table metadata. |
shape |
string | null |
Optional D2 shape. |
style |
D2StyleSchema |
Optional D2 style attributes. |
tooltip |
string | null |
Optional D2 tooltip. |
D2SystemQueueSchema¶
D2 JSON schema for a queue-like system.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Discriminator identifying the element type. Must be exactly SystemQueue. |
alias |
string | null |
Unique identifier for the element. If not provided, it is autogenerated from the label. |
classes |
array[string] |
Optional D2 classes. |
description |
string | null |
Optional description text. |
direction |
enum[up | down | left | right] | null |
Optional D2 layout direction for a container. |
icon |
string | null |
Optional D2 icon URL. |
label(required) |
string |
Display name for the element. |
link |
string | null |
Optional D2 link URL. |
near |
string | null |
Optional D2 near reference. |
properties |
DiagramElementPropertiesSchema |
Optional property table metadata. |
shape |
string | null |
Optional D2 shape. |
style |
D2StyleSchema |
Optional D2 style attributes. |
tooltip |
string | null |
Optional D2 tooltip. |
D2SystemSchema¶
D2 JSON schema for a software system.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Discriminator identifying the element type. Must be exactly System. |
alias |
string | null |
Unique identifier for the element. If not provided, it is autogenerated from the label. |
classes |
array[string] |
Optional D2 classes. |
description |
string | null |
Optional description text. |
direction |
enum[up | down | left | right] | null |
Optional D2 layout direction for a container. |
icon |
string | null |
Optional D2 icon URL. |
label(required) |
string |
Display name for the element. |
link |
string | null |
Optional D2 link URL. |
near |
string | null |
Optional D2 near reference. |
properties |
DiagramElementPropertiesSchema |
Optional property table metadata. |
shape |
string | null |
Optional D2 shape. |
style |
D2StyleSchema |
Optional D2 style attributes. |
tooltip |
string | null |
Optional D2 tooltip. |
DiagramElementPropertiesSchema¶
JSON schema for tabular diagram element properties.
Properties
| Field | Type | Description |
|---|---|---|
header |
array[string] |
Header columns. Default: ["Property", "Value"]. |
properties(required) |
array[array[string]] |
List of rows (each row is a list of string values). |
show_header |
boolean |
Whether to display the header row. Default: true. |
D2 Render Options¶
D2RenderOptionsSchema¶
Render options for the D2 renderer.
Properties
| Field | Type | Description |
|---|---|---|
auto_number_relationships |
boolean |
Auto Number Relationships Default: false. |
bidirectional_relationships |
enum[two_edges | single_edge] |
Bidirectional Relationships Default: two_edges. |
direction |
enum[up | down | left | right] | null |
Direction Default: right. |
fully_qualified_relationships |
boolean |
Fully Qualified Relationships Default: true. |
include_properties |
boolean |
Include Properties Default: false. |
include_technology |
boolean |
Include Technology Default: true. |
include_type_label |
boolean |
Include Type Label Default: true. |
layout |
enum[dagre | elk] |
Layout Default: dagre. |
legend |
D2LegendSchema |
|
sequence_diagram |
boolean |
Sequence Diagram Default: false. |
theme |
integer | null |
Theme |
title_near |
enum[top-left | top-center | top-right | center-left | center-right | bottom-left | bottom-center | bottom-right] | null |
Title Near Default: top-center. |
D2StyleSchema¶
D2 style attributes used by D2 render options.
Properties
| Field | Type | Description |
|---|---|---|
animated |
boolean | null |
Animated |
bold |
boolean | null |
Bold |
border_radius |
integer | null |
Border Radius |
double_border |
boolean | null |
Double Border |
fill |
string | null |
Fill |
fill_pattern |
string | null |
Fill Pattern |
font |
string | null |
Font |
font_color |
string | null |
Font Color |
font_size |
integer | null |
Font Size |
italic |
boolean | null |
Italic |
multiple |
boolean | null |
Multiple |
opacity |
number | null |
Opacity |
shadow |
boolean | null |
Shadow |
stroke |
string | null |
Stroke |
stroke_dash |
integer | null |
Stroke Dash |
stroke_width |
integer | null |
Stroke Width |
text_transform |
string | null |
Text Transform |
three_d |
boolean | null |
Three D |
underline |
boolean | null |
Underline |
D2LegendSchema¶
Structured D2 legend render options.
Properties
| Field | Type | Description |
|---|---|---|
items |
array[ |
Items |
label |
string |
Label Default: Legend. |
D2LegendElementSchema¶
Schema for a D2 legend node sample.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Legend item discriminator. Must be exactly element. |
alias |
string | null |
Optional D2 identifier. |
classes |
array[string] |
Classes |
icon |
string | null |
Icon |
label(required) |
string |
Legend item label. |
shape |
string | null |
Shape |
style |
D2StyleSchema |
D2LegendRelSchema¶
Schema for a D2 legend relationship sample.
Properties
| Field | Type | Description |
|---|---|---|
type(required) |
string |
Legend item discriminator. Must be exactly relationship. |
alias |
string | null |
Optional D2 identifier. |
bidirectional |
boolean |
Bidirectional Default: false. |
classes |
array[string] |
Classes |
hide_endpoints |
boolean | null |
Hide Endpoints |
label(required) |
string |
Legend item label. |
source |
string | null |
Source |
style |
D2StyleSchema |
|
target |
string | null |
Target |