From 10d10697992acc6f606bef0cae0d2f0fe038e4f6 Mon Sep 17 00:00:00 2001 From: sheng Date: Mon, 24 Aug 2026 11:15:34 +0800 Subject: [PATCH 1/2] class: complete stereotype propagation and fixtures --- .../cases/complex_class/expected.json | 3 + .../dependent_decltype_base/expected.json | 5 ++ .../cases/include_3rdparty/expected.json | 1 + .../cases/inherit_external_base/expected.json | 1 + .../cases/method_parameter_type/expected.json | 1 + .../cases/method_return_type/expected.json | 2 + .../cases/nest_namespace_class/expected.json | 1 + .../nested_type_relationship/expected.json | 3 + .../relationship_aggregation/expected.json | 2 + .../relationship_association/expected.json | 4 + .../relationship_composition/expected.json | 2 + .../relationship_dependency/expected.json | 5 ++ .../relationship_implementation/expected.json | 2 + .../relationship_inheritance/expected.json | 2 + .../same_name_diff_namespace/expected.json | 3 + .../cases/simple_enums/expected.json | 4 + .../cases/simple_struct/expected.json | 2 + .../expected.json | 1 + .../cases/std_string_alias/expected.json | 1 + .../expected.json | 1 + .../cases/template_class/expected.json | 2 + .../expected.json | 3 + .../expected.json | 3 + .../cases/type_alias/expected.json | 1 + .../cases/variable_namespace/expected.json | 2 + .../output.json | 1 + .../class_diagram_positive/output.json | 8 ++ .../class_diagram_syntax_coverage/output.json | 1 + .../src/class_diagram/src/class_ast.rs | 15 ++++ .../src/class_diagram/src/class_parser.rs | 9 +++ .../src/class_diagram/src/class_traits.rs | 1 + .../stereotype_definition/output.json | 3 + .../stereotype_relationship/output.json | 2 + .../src/class_diagram/src/class_resolver.rs | 73 +++++++++++-------- tools/metamodel/class/class_logic.rs | 2 + .../flatbuffers/class/class_diagram.fbs | 1 + .../flatbuffers/class/class_serializer.rs | 5 ++ .../core/src/models/class_diagram_models.rs | 5 ++ .../core/src/readers/class_diagram_reader.rs | 1 + .../class_design_implementation_validator.rs | 1 + .../core/src/validators/test/fixtures.rs | 1 + 41 files changed, 156 insertions(+), 30 deletions(-) diff --git a/cpp/libclang/integration_test/cases/complex_class/expected.json b/cpp/libclang/integration_test/cases/complex_class/expected.json index 259132a5..567b9f31 100644 --- a/cpp/libclang/integration_test/cases/complex_class/expected.json +++ b/cpp/libclang/integration_test/cases/complex_class/expected.json @@ -103,6 +103,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [ @@ -176,6 +177,7 @@ } ], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -290,6 +292,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [ diff --git a/cpp/libclang/integration_test/cases/dependent_decltype_base/expected.json b/cpp/libclang/integration_test/cases/dependent_decltype_base/expected.json index c5d06501..c4825211 100644 --- a/cpp/libclang/integration_test/cases/dependent_decltype_base/expected.json +++ b/cpp/libclang/integration_test/cases/dependent_decltype_base/expected.json @@ -24,6 +24,7 @@ } ], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -33,6 +34,7 @@ } }, "IsMaplikeContainer": { + "stereotype": null, "id": "IsMaplikeContainer", "name": "IsMaplikeContainer", "enclosing_namespace_id": null, @@ -75,6 +77,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -106,6 +109,7 @@ } ], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -134,6 +138,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], diff --git a/cpp/libclang/integration_test/cases/include_3rdparty/expected.json b/cpp/libclang/integration_test/cases/include_3rdparty/expected.json index b54e34ce..ec282e82 100644 --- a/cpp/libclang/integration_test/cases/include_3rdparty/expected.json +++ b/cpp/libclang/integration_test/cases/include_3rdparty/expected.json @@ -33,6 +33,7 @@ } ], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [ diff --git a/cpp/libclang/integration_test/cases/inherit_external_base/expected.json b/cpp/libclang/integration_test/cases/inherit_external_base/expected.json index f9246329..e929324e 100644 --- a/cpp/libclang/integration_test/cases/inherit_external_base/expected.json +++ b/cpp/libclang/integration_test/cases/inherit_external_base/expected.json @@ -8,6 +8,7 @@ "enum_literals": [], "methods": [], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [ diff --git a/cpp/libclang/integration_test/cases/method_parameter_type/expected.json b/cpp/libclang/integration_test/cases/method_parameter_type/expected.json index 4f5b3168..2bc08c4b 100644 --- a/cpp/libclang/integration_test/cases/method_parameter_type/expected.json +++ b/cpp/libclang/integration_test/cases/method_parameter_type/expected.json @@ -261,6 +261,7 @@ } ], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], diff --git a/cpp/libclang/integration_test/cases/method_return_type/expected.json b/cpp/libclang/integration_test/cases/method_return_type/expected.json index e9cbd21a..c084d9a2 100644 --- a/cpp/libclang/integration_test/cases/method_return_type/expected.json +++ b/cpp/libclang/integration_test/cases/method_return_type/expected.json @@ -145,6 +145,7 @@ "file": "cpp/libclang/integration_test/cases/method_return_type/transport.cpp", "line": 25 }, + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [] @@ -157,6 +158,7 @@ "enum_literals": [], "methods": [], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [ diff --git a/cpp/libclang/integration_test/cases/nest_namespace_class/expected.json b/cpp/libclang/integration_test/cases/nest_namespace_class/expected.json index ff2bfe13..69b421ce 100644 --- a/cpp/libclang/integration_test/cases/nest_namespace_class/expected.json +++ b/cpp/libclang/integration_test/cases/nest_namespace_class/expected.json @@ -54,6 +54,7 @@ } ], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], diff --git a/cpp/libclang/integration_test/cases/nested_type_relationship/expected.json b/cpp/libclang/integration_test/cases/nested_type_relationship/expected.json index ab7108fd..07e8c411 100644 --- a/cpp/libclang/integration_test/cases/nested_type_relationship/expected.json +++ b/cpp/libclang/integration_test/cases/nested_type_relationship/expected.json @@ -20,6 +20,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [ @@ -47,6 +48,7 @@ "enum_literals": [], "methods": [], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -63,6 +65,7 @@ "enum_literals": [], "methods": [], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], diff --git a/cpp/libclang/integration_test/cases/relationship_aggregation/expected.json b/cpp/libclang/integration_test/cases/relationship_aggregation/expected.json index 7dd0c941..98a902b5 100644 --- a/cpp/libclang/integration_test/cases/relationship_aggregation/expected.json +++ b/cpp/libclang/integration_test/cases/relationship_aggregation/expected.json @@ -31,6 +31,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [ @@ -108,6 +109,7 @@ "enum_literals": [], "methods": [], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], diff --git a/cpp/libclang/integration_test/cases/relationship_association/expected.json b/cpp/libclang/integration_test/cases/relationship_association/expected.json index fae6c6cf..815de751 100644 --- a/cpp/libclang/integration_test/cases/relationship_association/expected.json +++ b/cpp/libclang/integration_test/cases/relationship_association/expected.json @@ -39,6 +39,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -80,6 +81,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -121,6 +123,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -137,6 +140,7 @@ "enum_literals": [], "methods": [], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], diff --git a/cpp/libclang/integration_test/cases/relationship_composition/expected.json b/cpp/libclang/integration_test/cases/relationship_composition/expected.json index a2e5af2f..47421f3d 100644 --- a/cpp/libclang/integration_test/cases/relationship_composition/expected.json +++ b/cpp/libclang/integration_test/cases/relationship_composition/expected.json @@ -20,6 +20,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [ @@ -47,6 +48,7 @@ "enum_literals": [], "methods": [], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], diff --git a/cpp/libclang/integration_test/cases/relationship_dependency/expected.json b/cpp/libclang/integration_test/cases/relationship_dependency/expected.json index 91a1f0f9..1c879d04 100644 --- a/cpp/libclang/integration_test/cases/relationship_dependency/expected.json +++ b/cpp/libclang/integration_test/cases/relationship_dependency/expected.json @@ -39,6 +39,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -86,6 +87,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -127,6 +129,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -168,6 +171,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -184,6 +188,7 @@ "enum_literals": [], "methods": [], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], diff --git a/cpp/libclang/integration_test/cases/relationship_implementation/expected.json b/cpp/libclang/integration_test/cases/relationship_implementation/expected.json index 5011fd67..e5aa09c0 100644 --- a/cpp/libclang/integration_test/cases/relationship_implementation/expected.json +++ b/cpp/libclang/integration_test/cases/relationship_implementation/expected.json @@ -36,6 +36,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -83,6 +84,7 @@ } ], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], diff --git a/cpp/libclang/integration_test/cases/relationship_inheritance/expected.json b/cpp/libclang/integration_test/cases/relationship_inheritance/expected.json index b7944dca..1826f046 100644 --- a/cpp/libclang/integration_test/cases/relationship_inheritance/expected.json +++ b/cpp/libclang/integration_test/cases/relationship_inheritance/expected.json @@ -24,6 +24,7 @@ } ], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -52,6 +53,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], diff --git a/cpp/libclang/integration_test/cases/same_name_diff_namespace/expected.json b/cpp/libclang/integration_test/cases/same_name_diff_namespace/expected.json index b0c63e5b..527018fc 100644 --- a/cpp/libclang/integration_test/cases/same_name_diff_namespace/expected.json +++ b/cpp/libclang/integration_test/cases/same_name_diff_namespace/expected.json @@ -8,6 +8,7 @@ "enum_literals": [], "methods": [], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -24,6 +25,7 @@ "enum_literals": [], "methods": [], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -63,6 +65,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [ diff --git a/cpp/libclang/integration_test/cases/simple_enums/expected.json b/cpp/libclang/integration_test/cases/simple_enums/expected.json index d2382541..cdae8d27 100644 --- a/cpp/libclang/integration_test/cases/simple_enums/expected.json +++ b/cpp/libclang/integration_test/cases/simple_enums/expected.json @@ -41,6 +41,7 @@ ], "methods": [], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -90,6 +91,7 @@ ], "methods": [], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -131,6 +133,7 @@ ], "methods": [], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], @@ -196,6 +199,7 @@ ], "methods": [], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], diff --git a/cpp/libclang/integration_test/cases/simple_struct/expected.json b/cpp/libclang/integration_test/cases/simple_struct/expected.json index defe8e2c..72268c1e 100644 --- a/cpp/libclang/integration_test/cases/simple_struct/expected.json +++ b/cpp/libclang/integration_test/cases/simple_struct/expected.json @@ -20,6 +20,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [ @@ -117,6 +118,7 @@ "enum_literals": [], "methods": [], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [ diff --git a/cpp/libclang/integration_test/cases/std_internal_namespace_rendering/expected.json b/cpp/libclang/integration_test/cases/std_internal_namespace_rendering/expected.json index 0c85a670..92655060 100644 --- a/cpp/libclang/integration_test/cases/std_internal_namespace_rendering/expected.json +++ b/cpp/libclang/integration_test/cases/std_internal_namespace_rendering/expected.json @@ -32,6 +32,7 @@ "file": "cpp/libclang/integration_test/cases/std_internal_namespace_rendering/transport.cpp", "line": 17 }, + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [ diff --git a/cpp/libclang/integration_test/cases/std_string_alias/expected.json b/cpp/libclang/integration_test/cases/std_string_alias/expected.json index 5183cefa..1ba7b54a 100644 --- a/cpp/libclang/integration_test/cases/std_string_alias/expected.json +++ b/cpp/libclang/integration_test/cases/std_string_alias/expected.json @@ -50,6 +50,7 @@ } ], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [ diff --git a/cpp/libclang/integration_test/cases/std_template_specialization_filter/expected.json b/cpp/libclang/integration_test/cases/std_template_specialization_filter/expected.json index 069bf2d8..6f80ac67 100644 --- a/cpp/libclang/integration_test/cases/std_template_specialization_filter/expected.json +++ b/cpp/libclang/integration_test/cases/std_template_specialization_filter/expected.json @@ -13,6 +13,7 @@ "file": "./cpp/libclang/integration_test/cases/std_template_specialization_filter/specialization.h", "line": 23 }, + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [ diff --git a/cpp/libclang/integration_test/cases/template_class/expected.json b/cpp/libclang/integration_test/cases/template_class/expected.json index dec95fb1..87a58b03 100644 --- a/cpp/libclang/integration_test/cases/template_class/expected.json +++ b/cpp/libclang/integration_test/cases/template_class/expected.json @@ -21,6 +21,7 @@ } ], "relationships": [], + "stereotype": null, "template_parameters": [ { "Template": { @@ -146,6 +147,7 @@ } ], "relationships": [], + "stereotype": null, "template_parameters": [ { "Type": { diff --git a/cpp/libclang/integration_test/cases/template_partial_specialization_ids/expected.json b/cpp/libclang/integration_test/cases/template_partial_specialization_ids/expected.json index cd4a0cea..6dfc865c 100644 --- a/cpp/libclang/integration_test/cases/template_partial_specialization_ids/expected.json +++ b/cpp/libclang/integration_test/cases/template_partial_specialization_ids/expected.json @@ -33,6 +33,7 @@ "file": "./cpp/libclang/integration_test/cases/template_partial_specialization_ids/specialization_with_return.h", "line": 25 }, + "stereotype": null, "template_parameters": [ { "Type": { @@ -93,6 +94,7 @@ "file": "./cpp/libclang/integration_test/cases/template_partial_specialization_ids/specialization_without_return.h", "line": 25 }, + "stereotype": null, "template_parameters": [ { "Type": { @@ -127,6 +129,7 @@ "file": "./cpp/libclang/integration_test/cases/template_partial_specialization_ids/specialization.h", "line": 23 }, + "stereotype": null, "template_parameters": [ { "Type": { diff --git a/cpp/libclang/integration_test/cases/template_partial_specialization_relationship_target/expected.json b/cpp/libclang/integration_test/cases/template_partial_specialization_relationship_target/expected.json index 08ac6dd0..9f7e8af1 100644 --- a/cpp/libclang/integration_test/cases/template_partial_specialization_relationship_target/expected.json +++ b/cpp/libclang/integration_test/cases/template_partial_specialization_relationship_target/expected.json @@ -33,6 +33,7 @@ "file": "./cpp/libclang/integration_test/cases/template_partial_specialization_relationship_target/endpoint_without_return.h", "line": 23 }, + "stereotype": null, "template_parameters": [ { "Type": { @@ -67,6 +68,7 @@ "file": "./cpp/libclang/integration_test/cases/template_partial_specialization_relationship_target/endpoint.h", "line": 23 }, + "stereotype": null, "template_parameters": [ { "Type": { @@ -102,6 +104,7 @@ "file": "./cpp/libclang/integration_test/cases/template_partial_specialization_relationship_target/holder.h", "line": 24 }, + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [ diff --git a/cpp/libclang/integration_test/cases/type_alias/expected.json b/cpp/libclang/integration_test/cases/type_alias/expected.json index 80561614..80c15217 100644 --- a/cpp/libclang/integration_test/cases/type_alias/expected.json +++ b/cpp/libclang/integration_test/cases/type_alias/expected.json @@ -34,6 +34,7 @@ } ], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [ { diff --git a/cpp/libclang/integration_test/cases/variable_namespace/expected.json b/cpp/libclang/integration_test/cases/variable_namespace/expected.json index 7d458251..b885003d 100644 --- a/cpp/libclang/integration_test/cases/variable_namespace/expected.json +++ b/cpp/libclang/integration_test/cases/variable_namespace/expected.json @@ -31,6 +31,7 @@ } } ], + "stereotype": null, "template_parameters": null, "type_aliases": [ { @@ -117,6 +118,7 @@ "enum_literals": [], "methods": [], "relationships": [], + "stereotype": null, "template_parameters": null, "type_aliases": [], "variables": [], diff --git a/plantuml/parser/integration_test/class_diagram/class_diagram_file_level_constructs/output.json b/plantuml/parser/integration_test/class_diagram/class_diagram_file_level_constructs/output.json index 5c395948..1e523a11 100644 --- a/plantuml/parser/integration_test/class_diagram/class_diagram_file_level_constructs/output.json +++ b/plantuml/parser/integration_test/class_diagram/class_diagram_file_level_constructs/output.json @@ -73,6 +73,7 @@ "id": "sample.file_level.<