Files
cadSet/designir-pipeline/contracts/designir-2.0.schema.json
T
2026-07-27 17:24:04 +08:00

238 lines
6.2 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://cadset.local/schemas/designir-2.0.schema.json",
"title": "DesignIR 2.0",
"type": "object",
"additionalProperties": false,
"required": [
"schema_version",
"designir_kind",
"model_id",
"family",
"units",
"reconstruction_status",
"coordinate_system",
"datums",
"parameters",
"expressions",
"sketches",
"constraints",
"features",
"patterns",
"attachments",
"construction_stages",
"edit_interface",
"validation_contract"
],
"properties": {
"schema_version": {"const": "2.0"},
"designir_kind": {"const": "executable_parametric_design"},
"model_id": {"type": "string", "pattern": "^[A-Za-z0-9._-]+$"},
"family": {"type": "string", "minLength": 1},
"units": {"const": "mm"},
"backend_hint": {
"enum": ["auto", "build123d", "simplecadapi"]
},
"reconstruction_status": {
"enum": ["ready", "partial", "unsupported_feature_vocabulary"]
},
"missing_capabilities": {
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
},
"coordinate_system": {
"type": "object",
"additionalProperties": false,
"required": ["origin", "x_axis", "y_axis", "z_axis"],
"properties": {
"origin": {"$ref": "#/$defs/vector3"},
"x_axis": {"$ref": "#/$defs/vector3"},
"y_axis": {"$ref": "#/$defs/vector3"},
"z_axis": {"$ref": "#/$defs/vector3"}
}
},
"datums": {
"type": "object",
"additionalProperties": {"type": "object"}
},
"parameters": {
"type": "object",
"additionalProperties": {"$ref": "#/$defs/parameter"}
},
"expressions": {
"type": "object",
"additionalProperties": {"type": "string", "minLength": 1}
},
"sketches": {
"type": "array",
"items": {"type": "object"}
},
"constraints": {
"type": "array",
"items": {
"type": "object",
"required": ["kind", "participants"],
"properties": {
"id": {"type": "string"},
"kind": {"type": "string"},
"participants": {
"type": "array",
"items": {"type": "string"}
}
}
}
},
"features": {
"type": "array",
"items": {"$ref": "#/$defs/feature"}
},
"patterns": {
"type": "array",
"items": {"type": "object"}
},
"attachments": {
"type": "array",
"items": {"type": "object"}
},
"construction_stages": {
"type": "array",
"items": {
"type": "object",
"required": ["id", "feature_ids"],
"properties": {
"id": {"type": "string"},
"feature_ids": {
"type": "array",
"items": {"type": "string"}
}
}
}
},
"edit_interface": {
"type": "object",
"required": ["editable_parameters"],
"properties": {
"editable_parameters": {
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
},
"preserved_interfaces": {
"type": "array",
"items": {"type": "string"}
}
}
},
"validation_contract": {
"type": "object",
"required": ["invariants", "perturbations"],
"properties": {
"invariants": {
"type": "array",
"items": {"type": "object"}
},
"perturbations": {
"type": "array",
"items": {
"type": "object",
"required": ["parameter", "scale"],
"properties": {
"parameter": {"type": "string"},
"scale": {"type": "number", "exclusiveMinimum": 0},
"expected_change": {"type": "string"},
"preserve": {
"type": "array",
"items": {"type": "string"}
}
}
}
},
"thresholds": {"type": "object"}
}
},
"experience": {
"type": "object",
"properties": {
"promoted_method_ids": {
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
}
}
},
"confidence": {
"type": "object",
"additionalProperties": {"type": "number", "minimum": 0, "maximum": 1}
}
},
"$defs": {
"vector3": {
"type": "array",
"prefixItems": [
{"type": "number"},
{"type": "number"},
{"type": "number"}
],
"minItems": 3,
"maxItems": 3
},
"parameter": {
"type": "object",
"additionalProperties": false,
"required": ["value", "unit", "editable"],
"properties": {
"value": {"type": ["number", "integer"]},
"unit": {"enum": ["mm", "deg", "count", "ratio"]},
"editable": {"type": "boolean"},
"role": {"type": "string"},
"minimum": {"type": "number"},
"maximum": {"type": "number"}
}
},
"value": {
"oneOf": [
{"type": "number"},
{
"type": "object",
"additionalProperties": false,
"required": ["parameter"],
"properties": {"parameter": {"type": "string"}}
},
{
"type": "object",
"additionalProperties": false,
"required": ["expression"],
"properties": {"expression": {"type": "string"}}
}
]
},
"feature": {
"type": "object",
"required": ["id", "operation"],
"properties": {
"id": {"type": "string"},
"operation": {
"enum": [
"extrude_circle",
"extrude_rectangle",
"add_cylinder",
"through_hole",
"polar_hole_pattern"
]
},
"radius": {"$ref": "#/$defs/value"},
"diameter": {"$ref": "#/$defs/value"},
"height": {"$ref": "#/$defs/value"},
"width": {"$ref": "#/$defs/value"},
"depth": {"$ref": "#/$defs/value"},
"count": {"$ref": "#/$defs/value"},
"pitch_diameter": {"$ref": "#/$defs/value"},
"axis": {"type": "string"},
"center": {"$ref": "#/$defs/vector3"},
"host": {"type": "string"}
}
}
}
}