{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "ErdJson",
"description": "JSON representation of the ERD",
"type": "object",
"properties": {
"relationships": {
"type": "array",
"items": {
"$ref": "#/$defs/RelationshipJson"
}
},
"stats": {
"$ref": "#/$defs/ErdStats"
},
"tables": {
"type": "array",
"items": {
"$ref": "#/$defs/TableJson"
}
}
},
"required": ["tables", "relationships", "stats"],
"$defs": {
"ColumnJson": {
"description": "JSON representation of a column",
"type": "object",
"properties": {
"is_foreign_key": {
"type": "boolean"
},
"is_nullable": {
"type": "boolean"
},
"is_primary_key": {
"type": "boolean"
},
"name": {
"type": "string"
},
"references_column": {
"type": ["string", "null"]
},
"references_table": {
"type": ["string", "null"]
},
"type": {
"type": "string"
}
},
"required": [
"name",
"type",
"is_primary_key",
"is_foreign_key",
"is_nullable"
]
},
"ErdStats": {
"description": "ERD statistics",
"type": "object",
"properties": {
"column_count": {
"type": "integer",
"minimum": 0
},
"relationship_count": {
"type": "integer",
"minimum": 0
},
"table_count": {
"type": "integer",
"minimum": 0
}
},
"required": ["table_count", "column_count", "relationship_count"]
},
"RelationshipJson": {
"description": "JSON representation of a relationship",
"type": "object",
"properties": {
"cardinality": {
"type": "string"
},
"from_column": {
"type": "string"
},
"from_table": {
"type": "string"
},
"to_column": {
"type": "string"
},
"to_table": {
"type": "string"
}
},
"required": [
"from_table",
"from_column",
"to_table",
"to_column",
"cardinality"
]
},
"TableJson": {
"description": "JSON representation of a table with full column details",
"type": "object",
"properties": {
"columns": {
"type": "array",
"items": {
"$ref": "#/$defs/ColumnJson"
}
},
"name": {
"type": "string"
}
},
"required": ["name", "columns"]
}
}
}