forked from 1b-agent/opencadstudio-upstream
fix(python): validate nested input (vertices, edges) instead of defaulting silently
The generated dict-to-struct conversions for nested records defaulted every
absent field and ignored unknown keys, so an LwPolyline built from
{'x': .., 'y': ..} vertices became zero-coordinate vertices. They now refuse an
unknown key (naming the keys the record takes) and a manifest list,
required_struct_fields, enforces the fields that define a nested record's
geometry (vertex locations, hatch edge ends and centres, section symbol points).
Regression test over real IPC; every existing lifecycle audit still passes.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
360dd853ed
commit
81251d9cf3
4 files changed
+150
-2
No files matched your search
@@ -973,5 +973,46 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required_struct_fields": {
|
||||
"LwVertex": [
|
||||
"location"
|
||||
],
|
||||
"Vertex2D": [
|
||||
"location"
|
||||
],
|
||||
"Vertex3D": [
|
||||
"location"
|
||||
],
|
||||
"Vertex3DPolyline": [
|
||||
"position"
|
||||
],
|
||||
"PolygonMeshVertex": [
|
||||
"location"
|
||||
],
|
||||
"PolyfaceVertex": [
|
||||
"location"
|
||||
],
|
||||
"MLineVertex": [
|
||||
"position"
|
||||
],
|
||||
"LineEdge": [
|
||||
"start",
|
||||
"end"
|
||||
],
|
||||
"CircularArcEdge": [
|
||||
"center",
|
||||
"radius"
|
||||
],
|
||||
"EllipticArcEdge": [
|
||||
"center",
|
||||
"major_axis_endpoint"
|
||||
],
|
||||
"PolylineEdge": [
|
||||
"vertices"
|
||||
],
|
||||
"SectionSymbolPoint": [
|
||||
"point"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user