forked from 1b-agent/opencadstudio-upstream
ocs_doc_api: Phase 3-ii — typed AttributeDefinition create (Phase 3 complete)
- CreateAttributeDefinition(AttributeDefinitionSpec) op (append-only). - backend add_attribute_definition (ATTDEF tag/prompt/default/insertion/height/rotation). - facade create_attribute_definition; entity_kind_name AttributeDefinition/AttributeEntity. - spec AttributeDefinition family; api_reference + binding_schema regenerated; mocks + baseline. - Test phase3ii_create_attribute_definition -> 614 host lib + 3 consistency green.
This commit is contained in:
1 parent
8d8c120880
commit
f8ae54a351
14 files changed
+128
-3
No files matched your search
@@ -140,6 +140,12 @@ impl DocApiBackend for MockBackend {
|
||||
fn dimension_measurement(&self, id: ObjectId) -> ApiResult<f64> {
|
||||
self.dimension_measurements.get(&id).copied().ok_or(ApiError::UnknownId(id))
|
||||
}
|
||||
fn add_attribute_definition(&mut self, spec: &ocs_doc_api::ops::AttributeDefinitionSpec) -> ApiResult<ObjectId> {
|
||||
if spec.tag.is_empty() {
|
||||
return Err(ApiError::validation("CreateAttributeDefinition", "empty tag"));
|
||||
}
|
||||
Ok(self.alloc("AttributeDefinition"))
|
||||
}
|
||||
fn set_attribute(&mut self, id: ObjectId, tag: &str, value: &str) -> ApiResult<()> {
|
||||
if !self.entity_exists(id) {
|
||||
return Err(ApiError::UnknownId(id));
|
||||
|
||||
@@ -67,6 +67,9 @@ fn operation_variants() -> Vec<String> {
|
||||
Operation::CreateDimensionRadius(ocs_doc_api::ops::DimensionRadialSpec { center: [0.0; 3], point: [0.0; 3] }),
|
||||
Operation::CreateDimensionDiameter(ocs_doc_api::ops::DimensionRadialSpec { center: [0.0; 3], point: [0.0; 3] }),
|
||||
Operation::CreateDimensionAngular(ocs_doc_api::ops::DimensionAngularSpec { vertex: [0.0; 3], first_point: [0.0; 3], second_point: [0.0; 3], arc_location: [0.0; 3] }),
|
||||
Operation::CreateAttributeDefinition(ocs_doc_api::ops::AttributeDefinitionSpec {
|
||||
tag: String::new(), prompt: String::new(), default_value: String::new(), insertion_point: [0.0; 3], height: 0.0, rotation: 0.0,
|
||||
}),
|
||||
];
|
||||
// Derive the variant names by serializing a probe of each and reading the
|
||||
// bincode variant index -> name map is not available; instead match by
|
||||
@@ -159,6 +162,7 @@ const OPERATION_BASELINE: &[&str] = &[
|
||||
"CreateDimensionRadius",
|
||||
"CreateDimensionDiameter",
|
||||
"CreateDimensionAngular",
|
||||
"CreateAttributeDefinition",
|
||||
];
|
||||
|
||||
/// Recorded baseline of the `Query` variant order.
|
||||
|
||||
Reference in new issue
Block a user