Files
cad-building-showcase/schemas/building_spec.schema.json

126 lines
3.9 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://cad-building-showcase.local/schemas/building-spec-v1.json",
"title": "CAD Building Showcase building_spec.json",
"type": "object",
"required": ["schema_version", "project", "source", "units", "categories", "floors"],
"properties": {
"schema_version": {"const": 1},
"project": {
"type": "object",
"required": ["name", "description"],
"properties": {"name": {"type": "string"}, "description": {"type": "string"}},
"additionalProperties": true
},
"source": {
"type": "object",
"required": ["config"],
"properties": {
"dxf_dir": {"type": "string"},
"report": {"type": "string"},
"config": {"type": "object"}
},
"additionalProperties": true
},
"units": {
"type": "object",
"required": ["source", "scale_to_meters", "origin_source"],
"properties": {
"source": {"type": "string"},
"scale_to_meters": {"type": "number", "exclusiveMinimum": 0},
"origin_source": {"$ref": "#/$defs/point"}
},
"additionalProperties": false
},
"categories": {
"type": "object",
"additionalProperties": {
"type": "object",
"required": ["label", "color"],
"properties": {"label": {"type": "string"}, "color": {"type": "string"}},
"additionalProperties": true
}
},
"floors": {
"type": "object",
"additionalProperties": {"$ref": "#/$defs/floor"}
},
"extraction_report": {"type": "array", "items": {"type": "object"}}
},
"additionalProperties": false,
"$defs": {
"point": {
"type": "array",
"prefixItems": [{"type": "number"}, {"type": "number"}],
"minItems": 2,
"maxItems": 2
},
"rect": {
"type": "array",
"prefixItems": [
{"type": "number"}, {"type": "number"}, {"type": "number"}, {"type": "number"}
],
"minItems": 4,
"maxItems": 4
},
"segment": {
"type": "object",
"required": ["start", "end", "width", "layer", "source_type"],
"properties": {
"start": {"$ref": "#/$defs/point"},
"end": {"$ref": "#/$defs/point"},
"width": {"type": "number", "minimum": 0},
"layer": {"type": "string"},
"source_type": {"type": "string"},
"_z0": {"type": "number"},
"_z1": {"type": "number"}
},
"additionalProperties": true
},
"polygon": {
"type": "array",
"minItems": 3,
"items": {"$ref": "#/$defs/point"}
},
"footprint": {
"type": "object",
"required": ["polygons"],
"properties": {
"method": {"type": "string"},
"source": {"type": "string"},
"source_categories": {"type": "array", "items": {"type": "string"}},
"area": {"type": "number", "minimum": 0},
"polygons": {"type": "array", "items": {"$ref": "#/$defs/polygon"}}
},
"additionalProperties": true
},
"cap": {
"type": "object",
"required": ["z", "polygons"],
"properties": {
"z": {"type": "number"},
"polygons": {"type": "array", "items": {"$ref": "#/$defs/polygon"}}
},
"additionalProperties": false
},
"floor": {
"type": "object",
"required": ["name", "z", "height", "bounds", "source_file", "segments"],
"properties": {
"name": {"type": "string"},
"z": {"type": "number"},
"height": {"type": "number", "exclusiveMinimum": 0},
"bounds": {"$ref": "#/$defs/rect"},
"source_file": {"type": "string"},
"segments": {
"type": "object",
"additionalProperties": {"type": "array", "items": {"$ref": "#/$defs/segment"}}
},
"footprint": {"$ref": "#/$defs/footprint"},
"caps": {"type": "array", "items": {"$ref": "#/$defs/cap"}}
},
"additionalProperties": true
}
}
}