From 78c2245d9a41141f13d22c7d6d35dfded21ac200 Mon Sep 17 00:00:00 2001 From: Xian Gu Date: Tue, 7 Jul 2026 19:44:59 +0800 Subject: [PATCH 1/4] add source location in component --- MODULE.bazel | 5 +- plantuml/linker/src/main.rs | 16 +++- .../puml_parser/src/component_diagram/BUILD | 1 + .../component_diagram/src/component_ast.rs | 3 + .../component_diagram/src/component_parser.rs | 78 +++++++++++++++-- .../src/component_resolver.rs | 2 + .../tests/component_resolver_test.rs | 61 +++++++++++++ tools/metamodel/common/BUILD | 26 ++++++ tools/metamodel/common/source_location.rs | 85 +++++++++++++++++++ tools/metamodel/component/BUILD | 1 + tools/metamodel/component/component_logic.rs | 3 + .../component/component_diagram.fbs | 8 +- .../component/component_serializer.rs | 24 +++++- .../src/models/component_diagram_models.rs | 4 + .../src/readers/component_diagram_reader.rs | 10 ++- validation/core/src/readers/mod.rs | 6 ++ .../validators/bazel_component_validator.rs | 2 + .../test/component_sequence_validator_test.rs | 2 + .../core/src/validators/test/fixtures.rs | 4 + .../sequence_internal_api_validator_test.rs | 2 + 20 files changed, 324 insertions(+), 19 deletions(-) create mode 100644 tools/metamodel/common/BUILD create mode 100644 tools/metamodel/common/source_location.rs diff --git a/MODULE.bazel b/MODULE.bazel index 566d6a88..ee1b738e 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -108,7 +108,10 @@ crate.spec( version = "0.10", ) crate.spec( - features = ["derive"], + features = [ + "derive", + "rc", + ], package = "serde", version = "1.0", ) diff --git a/plantuml/linker/src/main.rs b/plantuml/linker/src/main.rs index 87ac1c88..d3e708e2 100644 --- a/plantuml/linker/src/main.rs +++ b/plantuml/linker/src/main.rs @@ -128,10 +128,18 @@ fn read_diagram(path: &str) -> Result { .map_err(|e| format!("Failed to parse FlatBuffer {path}: {e}"))?; let source_file = graph - .source_file() - .filter(|s| !s.is_empty()) - .map(|s| s.to_string()) - .ok_or_else(|| format!("Missing source_file in FlatBuffer: {path}"))?; + .components() + .and_then(|entries| { + entries + .iter() + .next() + .and_then(|entry| entry.value()) + .map(|comp| comp.source_location()) + .and_then(|location| location.file()) + .filter(|file| !file.is_empty()) + .map(ToOwned::to_owned) + }) + .unwrap_or_else(|| path.to_string()); let mut components = Vec::new(); if let Some(entries) = graph.components() { diff --git a/plantuml/parser/puml_parser/src/component_diagram/BUILD b/plantuml/parser/puml_parser/src/component_diagram/BUILD index 56f1bfac..2428b9bb 100644 --- a/plantuml/parser/puml_parser/src/component_diagram/BUILD +++ b/plantuml/parser/puml_parser/src/component_diagram/BUILD @@ -37,6 +37,7 @@ rust_library( deps = [ "//plantuml/parser/puml_parser:parser_core", "//plantuml/parser/puml_utils", + "//tools/metamodel/common:source_location", "@crates//:log", "@crates//:pest", "@crates//:serde", diff --git a/plantuml/parser/puml_parser/src/component_diagram/src/component_ast.rs b/plantuml/parser/puml_parser/src/component_diagram/src/component_ast.rs index 5972ac32..a14a7e52 100644 --- a/plantuml/parser/puml_parser/src/component_diagram/src/component_ast.rs +++ b/plantuml/parser/puml_parser/src/component_diagram/src/component_ast.rs @@ -12,6 +12,7 @@ // ******************************************************************************* pub use parser_core::common_ast::Arrow; use serde::{Deserialize, Serialize}; +use source_location::SourceLocation; #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct CompPumlDocument { @@ -48,6 +49,7 @@ pub struct Element { pub stereotype: Option, pub style: Option, pub statements: Vec, // For nested components + pub source_location: SourceLocation, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] @@ -57,6 +59,7 @@ pub struct Relation { pub rhs: String, pub style: Option, pub description: Option, + pub source_location: SourceLocation, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] diff --git a/plantuml/parser/puml_parser/src/component_diagram/src/component_parser.rs b/plantuml/parser/puml_parser/src/component_diagram/src/component_parser.rs index 78f615aa..a018b0f2 100644 --- a/plantuml/parser/puml_parser/src/component_diagram/src/component_parser.rs +++ b/plantuml/parser/puml_parser/src/component_diagram/src/component_parser.rs @@ -22,6 +22,7 @@ use parser_core::{ format_parse_tree, pest_to_syntax_error, BaseParseError, DiagramParser, ErrorLocation, }; use puml_utils::LogLevel; +use source_location::SourceLocation; use parser_core::common_parser::parse_arrow as common_parse_arrow; use parser_core::common_parser::{PlantUmlCommonParser, Rule}; @@ -56,21 +57,28 @@ pub struct PumlComponentParser; impl PumlComponentParser { fn parse_statement( pair: pest::iterators::Pair, + source_file: &str, ) -> Result, ComponentError> { for inner in pair.into_inner() { match inner.as_rule() { Rule::element => { - return Ok(vec![Statement::Element(Self::parse_element(inner)?)]); + return Ok(vec![Statement::Element(Self::parse_element( + inner, + source_file, + )?)]); } Rule::relation => { - return Ok(vec![Statement::Relation(Self::parse_relation(inner)?)]); + return Ok(vec![Statement::Relation(Self::parse_relation( + inner, + source_file, + )?)]); } Rule::port_declaration => { return Ok(vec![Statement::Port(Self::parse_port(inner)?)]); } Rule::together_block => { // Flatten children into the enclosing scope (drop the wrapper) - return Self::parse_together_block(inner); + return Self::parse_together_block(inner, source_file); } _ => {} } @@ -112,21 +120,26 @@ impl PumlComponentParser { fn parse_together_block( pair: pest::iterators::Pair, + source_file: &str, ) -> Result, ComponentError> { let mut stmts = Vec::new(); for inner in pair.into_inner() { if inner.as_rule() == Rule::diagram_statement { - stmts.append(&mut Self::parse_statement(inner)?); + stmts.append(&mut Self::parse_statement(inner, source_file)?); } } Ok(stmts) } - fn parse_element(pair: pest::iterators::Pair) -> Result { + fn parse_element( + pair: pest::iterators::Pair, + source_file: &str, + ) -> Result { let mut element = Element { kind: "".to_string(), name: None, alias: None, + source_location: SourceLocation::new(source_file, pair.line_col().0 as u32), stereotype: None, style: None, statements: Vec::new(), @@ -179,7 +192,7 @@ impl PumlComponentParser { element.style = Some(Self::parse_component_style(inner)?); } Rule::statement_block => { - element.statements = Self::parse_statement_block(inner)?; + element.statements = Self::parse_statement_block(inner, source_file)?; } _ => {} } @@ -188,12 +201,16 @@ impl PumlComponentParser { Ok(element) } - fn parse_relation(pair: pest::iterators::Pair) -> Result { + fn parse_relation( + pair: pest::iterators::Pair, + source_file: &str, + ) -> Result { let mut lhs = String::new(); let mut rhs = String::new(); let mut arrow = Arrow::default(); let mut description = None; + let source_line = pair.line_col().0 as u32; for inner in pair.into_inner() { match inner.as_rule() { @@ -219,6 +236,7 @@ impl PumlComponentParser { rhs, style: None, description, + source_location: SourceLocation::new(source_file, source_line), }) } @@ -330,13 +348,14 @@ impl PumlComponentParser { fn parse_statement_block( pair: pest::iterators::Pair, + source_file: &str, ) -> Result, ComponentError> { let mut statements = Vec::new(); for inner in pair.into_inner() { match inner.as_rule() { Rule::diagram_statement => { - let mut stmts = Self::parse_statement(inner)?; + let mut stmts = Self::parse_statement(inner, source_file)?; statements.append(&mut stmts); } _ => { @@ -382,6 +401,7 @@ impl DiagramParser for PumlComponentParser { name: None, statements: Vec::new(), }; + let source_file = path.as_ref().clone().to_string_lossy().to_string(); for pair in pairs { for inner_pair in pair.into_inner() { @@ -395,7 +415,7 @@ impl DiagramParser for PumlComponentParser { } } Rule::diagram_statement => { - let mut stmts = Self::parse_statement(inner_pair)?; + let mut stmts = Self::parse_statement(inner_pair, &source_file)?; document.statements.append(&mut stmts); } _ => { @@ -470,4 +490,44 @@ mod dispatch_style_tests { .expect("valid input must parse"); assert_eq!(doc.statements.len(), 3); } + + #[test] + fn test_source_locations_are_preserved() { + let input = "@startuml\ncomponent A\ncomponent B\nA --> B\n@enduml"; + let path = Rc::new(PathBuf::from("t.puml")); + let mut parser = PumlComponentParser; + let doc = parser + .parse_file(&path, input, LogLevel::Info) + .expect("valid input must parse"); + + let expected_file = path.as_ref().clone().to_string_lossy().to_string(); + + let first_element = match &doc.statements[0] { + Statement::Element(element) => element, + actual => panic!( + "expected first statement to be an element, got {:?}", + actual + ), + }; + + assert_eq!(first_element.source_location.line, 2); + assert_eq!( + first_element.source_location.file.as_ref(), + expected_file.as_str() + ); + + let relation = match &doc.statements[2] { + Statement::Relation(relation) => relation, + actual => panic!( + "expected third statement to be a relation, got {:?}", + actual + ), + }; + + assert_eq!(relation.source_location.line, 4); + assert_eq!( + relation.source_location.file.as_ref(), + expected_file.as_str() + ); + } } diff --git a/plantuml/parser/puml_resolver/src/component_diagram/src/component_resolver.rs b/plantuml/parser/puml_resolver/src/component_diagram/src/component_resolver.rs index 47cccd08..69690a36 100644 --- a/plantuml/parser/puml_resolver/src/component_diagram/src/component_resolver.rs +++ b/plantuml/parser/puml_resolver/src/component_diagram/src/component_resolver.rs @@ -696,6 +696,7 @@ impl ComponentResolver { annotation: relation.description.clone(), relation_type, source_role, + source_location: relation.source_location.clone(), }); Ok(()) @@ -797,6 +798,7 @@ impl ComponentResolver { id: fqn.clone(), name: element.name.clone(), alias: element.alias.clone(), + source_location: element.source_location.clone(), parent_id: parent_id.clone(), element_type: parse_kind(&element.kind)?, stereotype: element.stereotype.clone(), diff --git a/plantuml/parser/puml_resolver/src/component_diagram/tests/component_resolver_test.rs b/plantuml/parser/puml_resolver/src/component_diagram/tests/component_resolver_test.rs index 92a6a42f..39278419 100644 --- a/plantuml/parser/puml_resolver/src/component_diagram/tests/component_resolver_test.rs +++ b/plantuml/parser/puml_resolver/src/component_diagram/tests/component_resolver_test.rs @@ -258,3 +258,64 @@ fn test_arrows_link() { fn test_nested_elements() { run_deployment_resolver_case("nested_elements"); } + +#[test] +fn test_source_locations_are_preserved() { + use component_diagram::SourceLocation; + use component_parser::{CompPumlDocument, Element, Relation, Statement}; + use parser_core::common_ast::{Arrow, ArrowLine}; + + let component_location = SourceLocation::new("input.puml", 2); + let relation_location = SourceLocation::new("input.puml", 4); + + let document = CompPumlDocument { + name: None, + statements: vec![ + Statement::Element(Element { + kind: "component".to_string(), + name: Some("A".to_string()), + alias: None, + stereotype: None, + style: None, + statements: Vec::new(), + source_location: component_location.clone(), + }), + Statement::Element(Element { + kind: "component".to_string(), + name: Some("B".to_string()), + alias: None, + stereotype: None, + style: None, + statements: Vec::new(), + source_location: SourceLocation::new("input.puml", 3), + }), + Statement::Relation(Relation { + lhs: "A".to_string(), + arrow: Arrow { + left: None, + line: ArrowLine { + raw: "--".to_string(), + }, + middle: None, + right: None, + }, + rhs: "B".to_string(), + style: None, + description: None, + source_location: relation_location.clone(), + }), + ], + }; + + let mut resolver = ComponentResolver::new(); + let logic = resolver.resolve(&document).expect("document must resolve"); + + let component = logic.get("A").expect("component A must exist"); + assert_eq!(component.source_location, component_location); + + let relation = component + .relations + .first() + .expect("A must have one relation"); + assert_eq!(relation.source_location, relation_location); +} diff --git a/tools/metamodel/common/BUILD b/tools/metamodel/common/BUILD new file mode 100644 index 00000000..ac233eb1 --- /dev/null +++ b/tools/metamodel/common/BUILD @@ -0,0 +1,26 @@ +# ******************************************************************************* +# Copyright (c) 2026 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "source_location", + srcs = ["source_location.rs"], + crate_name = "source_location", + crate_root = "source_location.rs", + edition = "2021", + deps = [ + "@crates//:serde", + ], +) diff --git a/tools/metamodel/common/source_location.rs b/tools/metamodel/common/source_location.rs new file mode 100644 index 00000000..46e5f446 --- /dev/null +++ b/tools/metamodel/common/source_location.rs @@ -0,0 +1,85 @@ +// ******************************************************************************* +// Copyright (c) 2026 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available under the +// terms of the Apache License Version 2.0 which is available at +// +// +// SPDX-License-Identifier: Apache-2.0 +// ******************************************************************************* + +use std::path::Path; +use std::{fmt, rc::Rc}; + +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub struct SourceLocation { + pub file: Rc, + pub line: u32, +} + +impl SourceLocation { + pub fn new(file: impl Into>, line: u32) -> Self { + Self { + file: file.into(), + line, + } + } + + fn display_file_path(&self) -> String { + let file_path = Path::new(self.file.as_ref()); + + if file_path.is_absolute() { + if let Ok(cwd) = std::env::current_dir() { + if let Ok(relative) = file_path.strip_prefix(&cwd) { + return normalize_source_path(relative.to_string_lossy().as_ref()); + } + } + } + + normalize_source_path(self.file.as_ref()) + } +} + +fn normalize_source_path(path: &str) -> String { + path.strip_prefix("./").unwrap_or(path).to_string() +} + +impl fmt::Display for SourceLocation { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}:{}", self.display_file_path(), self.line) + } +} + +#[cfg(test)] +mod tests { + use super::SourceLocation; + + #[test] + fn display_uses_workspace_relative_path_for_absolute_file() { + let cwd = std::env::current_dir().expect("cwd must exist"); + let abs = cwd.join("tools/metamodel/common/source_location.rs"); + let location = SourceLocation::new(abs.to_string_lossy().to_string(), 7); + + assert_eq!( + location.to_string(), + "tools/metamodel/common/source_location.rs:7" + ); + } + + #[test] + fn display_keeps_relative_path() { + let location = SourceLocation::new("relative/path.puml", 3); + assert_eq!(location.to_string(), "relative/path.puml:3"); + } + + #[test] + fn display_strips_dot_slash_prefix() { + let location = SourceLocation::new("./relative/path.puml", 9); + assert_eq!(location.to_string(), "relative/path.puml:9"); + } +} diff --git a/tools/metamodel/component/BUILD b/tools/metamodel/component/BUILD index 46a9f2c8..52959f4d 100644 --- a/tools/metamodel/component/BUILD +++ b/tools/metamodel/component/BUILD @@ -21,6 +21,7 @@ rust_library( crate_root = "component_logic.rs", edition = "2021", deps = [ + "//tools/metamodel/common:source_location", "@crates//:serde", "@crates//:thiserror", ], diff --git a/tools/metamodel/component/component_logic.rs b/tools/metamodel/component/component_logic.rs index 931d8147..c65c7b35 100644 --- a/tools/metamodel/component/component_logic.rs +++ b/tools/metamodel/component/component_logic.rs @@ -11,6 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // ******************************************************************************* use serde::{Deserialize, Serialize}; +pub use source_location::SourceLocation; // #[derive(Debug, Clone)] // pub struct Package { @@ -27,6 +28,7 @@ pub struct LogicComponent { pub element_type: ComponentType, // e.g., package, component, etc. pub stereotype: Option, // e.g., component, unit, etc. pub relations: Vec, + pub source_location: SourceLocation, } #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)] @@ -65,6 +67,7 @@ pub struct LogicRelation { /// Role of source component w.r.t. target interface. #[serde(default)] pub source_role: EndpointRole, + pub source_location: SourceLocation, } #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Default)] diff --git a/tools/serialization/flatbuffers/component/component_diagram.fbs b/tools/serialization/flatbuffers/component/component_diagram.fbs index 06417e2b..ce0afae8 100644 --- a/tools/serialization/flatbuffers/component/component_diagram.fbs +++ b/tools/serialization/flatbuffers/component/component_diagram.fbs @@ -13,6 +13,11 @@ namespace component; +table SourceLocation { + file:string; + line:uint32; +} + enum ComponentRelationType:byte { Association, Dependency, @@ -30,6 +35,7 @@ table LogicRelation { annotation:string; relation_type:ComponentRelationType = Association; source_role:EndpointRole = None; + source_location:SourceLocation (required); } enum ComponentType:byte { @@ -65,6 +71,7 @@ table LogicComponent { comp_type:ComponentType; stereotype:string; relations:[LogicRelation]; + source_location:SourceLocation (required); } table ComponentMap { @@ -74,7 +81,6 @@ table ComponentMap { table ComponentGraph { components:[ComponentMap]; - source_file:string; } root_type ComponentGraph; diff --git a/tools/serialization/flatbuffers/component/component_serializer.rs b/tools/serialization/flatbuffers/component/component_serializer.rs index 6c648961..85d9dafc 100644 --- a/tools/serialization/flatbuffers/component/component_serializer.rs +++ b/tools/serialization/flatbuffers/component/component_serializer.rs @@ -20,8 +20,12 @@ use component_fbs::component as fb; pub struct ComponentSerializer; impl ComponentSerializer { - pub fn serialize(elements: &HashMap, source_file: &str) -> Vec { + pub fn serialize(elements: &HashMap, _diagram_file: &str) -> Vec { let mut builder = FlatBufferBuilder::new(); + let source_file = elements + .values() + .next() + .map(|e| builder.create_string(e.source_location.file.as_ref())); // -------------------------- // 1) build components @@ -34,6 +38,13 @@ impl ComponentSerializer { for r in &element.relations { let target_offset = builder.create_string(&r.target); let annotation_offset = r.annotation.as_ref().map(|s| builder.create_string(s)); + let relation_source_location = fb::SourceLocation::create( + &mut builder, + &fb::SourceLocationArgs { + file: source_file, + line: r.source_location.line, + }, + ); let rel = fb::LogicRelation::create( &mut builder, @@ -42,6 +53,7 @@ impl ComponentSerializer { annotation: annotation_offset, relation_type: Self::convert_relation_type(r.relation_type), source_role: Self::convert_endpoint_role(r.source_role), + source_location: Some(relation_source_location), }, ); relation_offsets.push(rel); @@ -59,6 +71,13 @@ impl ComponentSerializer { .stereotype .as_ref() .map(|s| builder.create_string(s)); + let comp_source_location = fb::SourceLocation::create( + &mut builder, + &fb::SourceLocationArgs { + file: source_file, + line: element.source_location.line, + }, + ); let comp_offset = fb::LogicComponent::create( &mut builder, @@ -70,6 +89,7 @@ impl ComponentSerializer { comp_type: Self::convert_type(element.element_type), stereotype: comp_stereotype_offset, relations: Some(relations_vector_offset), + source_location: Some(comp_source_location), }, ); @@ -93,12 +113,10 @@ impl ComponentSerializer { // -------------------------- // 3) root object // -------------------------- - let source_file_offset = builder.create_string(source_file); let root = fb::ComponentGraph::create( &mut builder, &fb::ComponentGraphArgs { components: Some(comps_vec), - source_file: Some(source_file_offset), }, ); diff --git a/validation/core/src/models/component_diagram_models.rs b/validation/core/src/models/component_diagram_models.rs index 6151f6b3..ea8fa73f 100644 --- a/validation/core/src/models/component_diagram_models.rs +++ b/validation/core/src/models/component_diagram_models.rs @@ -15,6 +15,8 @@ use std::collections::BTreeMap; use super::EntityKey; use crate::ValidationResult; +#[cfg(test)] +use component_diagram::SourceLocation; pub use component_diagram::{ ComponentRelationType, ComponentType, EndpointRole, LogicComponent, LogicRelation, }; @@ -191,6 +193,7 @@ mod tests { annotation: None, relation_type: ComponentRelationType::Association, source_role: EndpointRole::None, + source_location: SourceLocation::new("", 0), } } @@ -210,6 +213,7 @@ mod tests { element_type, stereotype: stereotype.map(str::to_string), relations, + source_location: SourceLocation::new("", 0), } } diff --git a/validation/core/src/readers/component_diagram_reader.rs b/validation/core/src/readers/component_diagram_reader.rs index be94d93a..357c0b2b 100644 --- a/validation/core/src/readers/component_diagram_reader.rs +++ b/validation/core/src/readers/component_diagram_reader.rs @@ -22,7 +22,7 @@ use crate::models::{ ComponentDiagramInputs, ComponentRelationType, ComponentType, EndpointRole, LogicComponent, LogicRelation, }; -use crate::readers::Reader; +use crate::readers::{to_source_location, Reader}; pub struct ComponentDiagramReader; @@ -74,6 +74,10 @@ fn read_relations( annotation: relation.annotation().map(|value| value.to_string()), relation_type: map_relation_type(relation.relation_type()), source_role: map_endpoint_role(relation.source_role()), + source_location: to_source_location( + relation.source_location().file(), + relation.source_location().line(), + ), }) }) .collect::, String>>() @@ -126,6 +130,10 @@ impl ComponentDiagramReader { element_type, stereotype: comp.stereotype().map(|s| s.to_string()), relations: read_relations(&comp, &context)?, + source_location: to_source_location( + comp.source_location().file(), + comp.source_location().line(), + ), }); } } else { diff --git a/validation/core/src/readers/mod.rs b/validation/core/src/readers/mod.rs index 46a68cca..3332d209 100644 --- a/validation/core/src/readers/mod.rs +++ b/validation/core/src/readers/mod.rs @@ -13,6 +13,8 @@ //! Input readers for Bazel JSON and PlantUML-derived FlatBuffer artifacts. +use component_diagram::SourceLocation; + mod bazel_reader; mod class_diagram_reader; mod component_diagram_reader; @@ -46,6 +48,10 @@ pub trait Reader { fn read(input: &Self::Input) -> Result; } +pub(crate) fn to_source_location(file: Option<&str>, line: u32) -> SourceLocation { + SourceLocation::new(file.unwrap_or_default(), line) +} + pub use bazel_reader::BazelReader; pub use class_diagram_reader::ClassDiagramReader; pub use component_diagram_reader::ComponentDiagramReader; diff --git a/validation/core/src/validators/bazel_component_validator.rs b/validation/core/src/validators/bazel_component_validator.rs index ca30562c..0466c32f 100644 --- a/validation/core/src/validators/bazel_component_validator.rs +++ b/validation/core/src/validators/bazel_component_validator.rs @@ -229,6 +229,7 @@ mod tests { use crate::models::{ BazelInput, BazelInputEntry, ComponentDiagramInputs, ComponentType, LogicComponent, }; + use component_diagram::SourceLocation; use std::collections::BTreeMap; fn make_arch(entries: Vec<(&str, Vec<&str>, Vec<&str>)>) -> BazelInput { @@ -265,6 +266,7 @@ mod tests { element_type, stereotype: stereotype.map(|s| s.to_string()), relations: Vec::new(), + source_location: SourceLocation::new("", 0), } } diff --git a/validation/core/src/validators/test/component_sequence_validator_test.rs b/validation/core/src/validators/test/component_sequence_validator_test.rs index 8122ace4..b4088e40 100644 --- a/validation/core/src/validators/test/component_sequence_validator_test.rs +++ b/validation/core/src/validators/test/component_sequence_validator_test.rs @@ -14,6 +14,7 @@ use super::super::fixtures::*; use super::*; use crate::models::{ComponentDiagramInputs, ComponentType, LogicComponent, SequenceDiagramInputs}; use crate::ValidationResult; +use component_diagram::SourceLocation; fn validate( component_diagrams: ComponentDiagramInputs, @@ -72,6 +73,7 @@ fn units_without_alias_are_ignored() { element_type: ComponentType::Component, stereotype: Some("unit".to_string()), relations: Vec::new(), + source_location: SourceLocation::new("", 0), }], }; let sequence_diagrams = sequence_diagrams(&[]); diff --git a/validation/core/src/validators/test/fixtures.rs b/validation/core/src/validators/test/fixtures.rs index 4ea7bdf2..12b87dd3 100644 --- a/validation/core/src/validators/test/fixtures.rs +++ b/validation/core/src/validators/test/fixtures.rs @@ -17,6 +17,7 @@ use crate::models::{ }; use crate::ValidationResult; use class_diagram::{ClassDiagram, EntityType, Method, SimpleEntity, Visibility}; +use component_diagram::SourceLocation; use sequence_logic::{Event, Interaction, SequenceNode, SequenceTree}; pub(super) fn relation_with_role(target: &str, source_role: EndpointRole) -> LogicRelation { @@ -33,6 +34,7 @@ pub(super) fn relation_with_type_and_role( annotation: None, relation_type, source_role, + source_location: SourceLocation::new("", 0), } } @@ -61,6 +63,7 @@ pub(super) fn unit_with_interface_roles( element_type: ComponentType::Component, stereotype: Some("unit".to_string()), relations, + source_location: SourceLocation::new("", 0), } } @@ -77,6 +80,7 @@ pub(super) fn interface_with_id(id: &str, alias: &str) -> LogicComponent { element_type: ComponentType::Interface, stereotype: None, relations: Vec::new(), + source_location: SourceLocation::new("", 0), } } diff --git a/validation/core/src/validators/test/sequence_internal_api_validator_test.rs b/validation/core/src/validators/test/sequence_internal_api_validator_test.rs index dde14262..d6ed366e 100644 --- a/validation/core/src/validators/test/sequence_internal_api_validator_test.rs +++ b/validation/core/src/validators/test/sequence_internal_api_validator_test.rs @@ -18,6 +18,7 @@ use crate::models::{ SequenceDiagramInputs, }; use crate::ValidationResult; +use component_diagram::SourceLocation; fn validate( sequence_diagrams: SequenceDiagramInputs, @@ -54,6 +55,7 @@ fn unit_with_non_binding_interface(alias: &str, interface_id: &str) -> LogicComp ComponentRelationType::Dependency, EndpointRole::None, )], + source_location: SourceLocation::new("", 0), } } From 88ce4bb2b6e38bf64d1e1ff239c6838cf22be45b Mon Sep 17 00:00:00 2001 From: Xian Gu Date: Wed, 8 Jul 2026 14:36:15 +0800 Subject: [PATCH 2/4] adapt component integration tests --- .../arrow_lollipop/output.json | 36 +++- .../output.json | 30 ++- .../output.json | 30 ++- .../plantuml/basic_example/output.json | 12 +- .../changing_arrows_direction/output.json | 12 +- .../changing_arrows_direction2/output.json | 12 +- .../changing_arrows_direction3/output.json | 24 ++- .../plantuml/component/output.json | 24 ++- .../plantuml/grouping_components/output.json | 24 ++- .../output.json | 24 ++- .../plantuml/individual_colors/output.json | 6 +- .../plantuml/interfaces/output.json | 30 ++- .../plantuml/long_description/output.json | 6 +- .../plantuml/use_uml2_notation/output.json | 18 +- .../component_diagram/port_alias/output.json | 25 ++- .../component_diagram/port_basic/output.json | 12 +- .../port_deep_nesting/output.json | 31 ++- .../output.json | 36 +++- .../port_global_name_resolution/output.json | 25 ++- .../port_relation_lifting/output.json | 25 ++- .../output.json | 18 +- .../port_two_ports/output.json | 25 ++- .../relation_absolute_fqn/output.json | 31 ++- .../relation_fqn/output.json | 40 +++- .../output.json | 24 ++- .../output.json | 24 ++- .../output.json | 25 ++- .../relation_relative_name/output.json | 37 +++- .../relation_reverse_simple_name/output.json | 25 ++- .../relation_simple_name/output.json | 44 ++++- .../relation_simple_name_alias/output.json | 31 ++- .../together_basic/output.json | 18 +- .../together_with_relation/output.json | 25 ++- .../top_level_port/output.json | 19 +- .../arrows_link/output.json | 181 +++++++++++++++--- .../declare_elements/output.json | 126 ++++++++++-- .../deployment_diagram_it/output.json | 76 ++++++-- .../nested_elements/output.json | 90 +++++++-- .../integration_test/src/test_framework.rs | 27 ++- 39 files changed, 1113 insertions(+), 215 deletions(-) diff --git a/plantuml/parser/integration_test/component_diagram/arrow_lollipop/output.json b/plantuml/parser/integration_test/component_diagram/arrow_lollipop/output.json index ef4a84ea..6ff68602 100644 --- a/plantuml/parser/integration_test/component_diagram/arrow_lollipop/output.json +++ b/plantuml/parser/integration_test/component_diagram/arrow_lollipop/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "SampleSEooC.ComponentA": { "id": "SampleSEooC.ComponentA", @@ -21,9 +25,17 @@ "target": "SampleSEooC.IService", "annotation": "provides", "relation_type": "InterfaceBinding", - "source_role": "Provided" + "source_role": "Provided", + "source_location": { + "file": "", + "line": 23 + } } - ] + ], + "source_location": { + "file": "", + "line": 16 + } }, "SampleSEooC.ComponentB": { "id": "SampleSEooC.ComponentB", @@ -37,9 +49,17 @@ "target": "SampleSEooC.IService", "annotation": "requires", "relation_type": "InterfaceBinding", - "source_role": "Required" + "source_role": "Required", + "source_location": { + "file": "", + "line": 24 + } } - ] + ], + "source_location": { + "file": "", + "line": 18 + } }, "SampleSEooC.IService": { "id": "SampleSEooC.IService", @@ -48,7 +68,11 @@ "parent_id": "SampleSEooC", "comp_type": "Interface", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 21 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/package_component_interface_binding/output.json b/plantuml/parser/integration_test/component_diagram/package_component_interface_binding/output.json index 7daac04e..ee57bd7a 100644 --- a/plantuml/parser/integration_test/component_diagram/package_component_interface_binding/output.json +++ b/plantuml/parser/integration_test/component_diagram/package_component_interface_binding/output.json @@ -12,15 +12,27 @@ "target": "IRequired", "annotation": "requires", "relation_type": "InterfaceBinding", - "source_role": "Required" + "source_role": "Required", + "source_location": { + "file": "", + "line": 23 + } }, { "target": "IProvided", "annotation": "provides", "relation_type": "InterfaceBinding", - "source_role": "Provided" + "source_role": "Provided", + "source_location": { + "file": "", + "line": 24 + } } - ] + ], + "source_location": { + "file": "", + "line": 15 + } }, "IRequired": { "id": "IRequired", @@ -29,7 +41,11 @@ "parent_id": null, "comp_type": "Interface", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 20 + } }, "IProvided": { "id": "IProvided", @@ -38,7 +54,11 @@ "parent_id": null, "comp_type": "Interface", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 21 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/package_seooc_interface_binding/output.json b/plantuml/parser/integration_test/component_diagram/package_seooc_interface_binding/output.json index 60e7acfb..209d186d 100644 --- a/plantuml/parser/integration_test/component_diagram/package_seooc_interface_binding/output.json +++ b/plantuml/parser/integration_test/component_diagram/package_seooc_interface_binding/output.json @@ -12,15 +12,27 @@ "target": "IRequired", "annotation": "requires", "relation_type": "InterfaceBinding", - "source_role": "Required" + "source_role": "Required", + "source_location": { + "file": "", + "line": 23 + } }, { "target": "IProvided", "annotation": "provides", "relation_type": "InterfaceBinding", - "source_role": "Provided" + "source_role": "Provided", + "source_location": { + "file": "", + "line": 24 + } } - ] + ], + "source_location": { + "file": "", + "line": 15 + } }, "IRequired": { "id": "IRequired", @@ -29,7 +41,11 @@ "parent_id": null, "comp_type": "Interface", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 20 + } }, "IProvided": { "id": "IProvided", @@ -38,7 +54,11 @@ "parent_id": null, "comp_type": "Interface", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 21 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/plantuml/basic_example/output.json b/plantuml/parser/integration_test/component_diagram/plantuml/basic_example/output.json index 4a4e5406..9f271da7 100644 --- a/plantuml/parser/integration_test/component_diagram/plantuml/basic_example/output.json +++ b/plantuml/parser/integration_test/component_diagram/plantuml/basic_example/output.json @@ -15,7 +15,11 @@ }, "rhs": "[Signal Adapter]", "style": null, - "description": null + "description": null, + "source_location": { + "file": "", + "line": 15 + } } }, { @@ -33,7 +37,11 @@ }, "rhs": "CalibrationBus", "style": null, - "description": "forwards" + "description": "forwards", + "source_location": { + "file": "", + "line": 16 + } } } ] diff --git a/plantuml/parser/integration_test/component_diagram/plantuml/changing_arrows_direction/output.json b/plantuml/parser/integration_test/component_diagram/plantuml/changing_arrows_direction/output.json index 0dd71b7e..bb524efb 100644 --- a/plantuml/parser/integration_test/component_diagram/plantuml/changing_arrows_direction/output.json +++ b/plantuml/parser/integration_test/component_diagram/plantuml/changing_arrows_direction/output.json @@ -17,7 +17,11 @@ }, "rhs": "SampleIngress", "style": null, - "description": null + "description": null, + "source_location": { + "file": "", + "line": 14 + } } }, { @@ -35,7 +39,11 @@ }, "rhs": "CommandEgress", "style": null, - "description": null + "description": null, + "source_location": { + "file": "", + "line": 15 + } } } ] diff --git a/plantuml/parser/integration_test/component_diagram/plantuml/changing_arrows_direction2/output.json b/plantuml/parser/integration_test/component_diagram/plantuml/changing_arrows_direction2/output.json index 8bd38f5d..06272eec 100644 --- a/plantuml/parser/integration_test/component_diagram/plantuml/changing_arrows_direction2/output.json +++ b/plantuml/parser/integration_test/component_diagram/plantuml/changing_arrows_direction2/output.json @@ -17,7 +17,11 @@ }, "rhs": "[Telemetry Hub]", "style": null, - "description": null + "description": null, + "source_location": { + "file": "", + "line": 14 + } } }, { @@ -35,7 +39,11 @@ }, "rhs": "[Telemetry Hub]", "style": null, - "description": null + "description": null, + "source_location": { + "file": "", + "line": 15 + } } } ] diff --git a/plantuml/parser/integration_test/component_diagram/plantuml/changing_arrows_direction3/output.json b/plantuml/parser/integration_test/component_diagram/plantuml/changing_arrows_direction3/output.json index 3c804f0e..cfcede4b 100644 --- a/plantuml/parser/integration_test/component_diagram/plantuml/changing_arrows_direction3/output.json +++ b/plantuml/parser/integration_test/component_diagram/plantuml/changing_arrows_direction3/output.json @@ -21,7 +21,11 @@ }, "rhs": "westQueue", "style": null, - "description": null + "description": null, + "source_location": { + "file": "", + "line": 14 + } } }, { @@ -43,7 +47,11 @@ }, "rhs": "eastQueue", "style": null, - "description": null + "description": null, + "source_location": { + "file": "", + "line": 15 + } } }, { @@ -65,7 +73,11 @@ }, "rhs": "northQueue", "style": null, - "description": null + "description": null, + "source_location": { + "file": "", + "line": 16 + } } }, { @@ -87,7 +99,11 @@ }, "rhs": "southQueue", "style": null, - "description": null + "description": null, + "source_location": { + "file": "", + "line": 17 + } } } ] diff --git a/plantuml/parser/integration_test/component_diagram/plantuml/component/output.json b/plantuml/parser/integration_test/component_diagram/plantuml/component/output.json index 04831ba3..6edc0d1f 100644 --- a/plantuml/parser/integration_test/component_diagram/plantuml/component/output.json +++ b/plantuml/parser/integration_test/component_diagram/plantuml/component/output.json @@ -9,7 +9,11 @@ "alias": null, "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 15 + } } }, { @@ -19,7 +23,11 @@ "alias": "CalibrationSvc", "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 16 + } } }, { @@ -29,7 +37,11 @@ "alias": null, "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 17 + } } }, { @@ -39,7 +51,11 @@ "alias": "FallbackRecorder", "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 18 + } } } ] diff --git a/plantuml/parser/integration_test/component_diagram/plantuml/grouping_components/output.json b/plantuml/parser/integration_test/component_diagram/plantuml/grouping_components/output.json index 3a04ae49..887c7d6b 100644 --- a/plantuml/parser/integration_test/component_diagram/plantuml/grouping_components/output.json +++ b/plantuml/parser/integration_test/component_diagram/plantuml/grouping_components/output.json @@ -9,7 +9,11 @@ "alias": null, "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 15 + } } }, { @@ -19,7 +23,11 @@ "alias": "Comp2", "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 16 + } } }, { @@ -29,7 +37,11 @@ "alias": null, "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 17 + } } }, { @@ -39,7 +51,11 @@ "alias": "Comp4", "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 18 + } } } ] diff --git a/plantuml/parser/integration_test/component_diagram/plantuml/hide_or_remove_unlinked_component/output.json b/plantuml/parser/integration_test/component_diagram/plantuml/hide_or_remove_unlinked_component/output.json index 4187e37c..ab2428e4 100644 --- a/plantuml/parser/integration_test/component_diagram/plantuml/hide_or_remove_unlinked_component/output.json +++ b/plantuml/parser/integration_test/component_diagram/plantuml/hide_or_remove_unlinked_component/output.json @@ -9,7 +9,11 @@ "alias": null, "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 14 + } } }, { @@ -19,7 +23,11 @@ "alias": null, "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 15 + } } }, { @@ -29,7 +37,11 @@ "alias": null, "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 16 + } } }, { @@ -45,7 +57,11 @@ }, "rhs": "DiagnosticsPanel", "style": null, - "description": null + "description": null, + "source_location": { + "file": "", + "line": 17 + } } } ] diff --git a/plantuml/parser/integration_test/component_diagram/plantuml/individual_colors/output.json b/plantuml/parser/integration_test/component_diagram/plantuml/individual_colors/output.json index eabae170..d592b794 100644 --- a/plantuml/parser/integration_test/component_diagram/plantuml/individual_colors/output.json +++ b/plantuml/parser/integration_test/component_diagram/plantuml/individual_colors/output.json @@ -12,7 +12,11 @@ "color": null, "attributes": [] }, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 14 + } } } ] diff --git a/plantuml/parser/integration_test/component_diagram/plantuml/interfaces/output.json b/plantuml/parser/integration_test/component_diagram/plantuml/interfaces/output.json index acec29aa..cae6e3f7 100644 --- a/plantuml/parser/integration_test/component_diagram/plantuml/interfaces/output.json +++ b/plantuml/parser/integration_test/component_diagram/plantuml/interfaces/output.json @@ -9,7 +9,11 @@ "alias": null, "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 15 + } } }, { @@ -19,7 +23,11 @@ "alias": "StatusOut", "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 16 + } } }, { @@ -29,7 +37,11 @@ "alias": null, "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 17 + } } }, { @@ -39,7 +51,11 @@ "alias": "SafetyFeedback", "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 18 + } } }, { @@ -49,7 +65,11 @@ "alias": null, "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 20 + } } } ] diff --git a/plantuml/parser/integration_test/component_diagram/plantuml/long_description/output.json b/plantuml/parser/integration_test/component_diagram/plantuml/long_description/output.json index 607ab033..e408c122 100644 --- a/plantuml/parser/integration_test/component_diagram/plantuml/long_description/output.json +++ b/plantuml/parser/integration_test/component_diagram/plantuml/long_description/output.json @@ -9,7 +9,11 @@ "alias": null, "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 14 + } } } ] diff --git a/plantuml/parser/integration_test/component_diagram/plantuml/use_uml2_notation/output.json b/plantuml/parser/integration_test/component_diagram/plantuml/use_uml2_notation/output.json index 32bfc934..68ca0e0e 100644 --- a/plantuml/parser/integration_test/component_diagram/plantuml/use_uml2_notation/output.json +++ b/plantuml/parser/integration_test/component_diagram/plantuml/use_uml2_notation/output.json @@ -9,7 +9,11 @@ "alias": "Feed", "stereotype": null, "style": null, - "statements": [] + "statements": [], + "source_location": { + "file": "", + "line": 15 + } } }, { @@ -25,7 +29,11 @@ }, "rhs": "[Normalizer Unit]", "style": null, - "description": null + "description": null, + "source_location": { + "file": "", + "line": 17 + } } }, { @@ -43,7 +51,11 @@ }, "rhs": "AuditTrail", "style": null, - "description": "records" + "description": "records", + "source_location": { + "file": "", + "line": 18 + } } } ] diff --git a/plantuml/parser/integration_test/component_diagram/port_alias/output.json b/plantuml/parser/integration_test/component_diagram/port_alias/output.json index d0411224..fa26efee 100644 --- a/plantuml/parser/integration_test/component_diagram/port_alias/output.json +++ b/plantuml/parser/integration_test/component_diagram/port_alias/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "SampleSEooC.ClientComp": { "id": "SampleSEooC.ClientComp", @@ -20,9 +24,18 @@ { "target": "SampleSEooC.ServerComp", "annotation": "calls", - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 22 + } } - ] + ], + "source_location": { + "file": "", + "line": 16 + } }, "SampleSEooC.ServerComp": { "id": "SampleSEooC.ServerComp", @@ -31,7 +44,11 @@ "parent_id": "SampleSEooC", "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 19 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/port_basic/output.json b/plantuml/parser/integration_test/component_diagram/port_basic/output.json index 6576cf96..ced53860 100644 --- a/plantuml/parser/integration_test/component_diagram/port_basic/output.json +++ b/plantuml/parser/integration_test/component_diagram/port_basic/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "SampleSEooC.ComponentA": { "id": "SampleSEooC.ComponentA", @@ -16,7 +20,11 @@ "parent_id": "SampleSEooC", "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 16 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/port_deep_nesting/output.json b/plantuml/parser/integration_test/component_diagram/port_deep_nesting/output.json index 0cc28366..7701bde2 100644 --- a/plantuml/parser/integration_test/component_diagram/port_deep_nesting/output.json +++ b/plantuml/parser/integration_test/component_diagram/port_deep_nesting/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "Root.SampleSEooC": { "id": "Root.SampleSEooC", @@ -16,7 +20,11 @@ "parent_id": "Root", "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 16 + } }, "Root.SampleSEooC.ClientComp": { "id": "Root.SampleSEooC.ClientComp", @@ -29,9 +37,18 @@ { "target": "Root.SampleSEooC.ServerComp", "annotation": "calls", - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 23 + } } - ] + ], + "source_location": { + "file": "", + "line": 17 + } }, "Root.SampleSEooC.ServerComp": { "id": "Root.SampleSEooC.ServerComp", @@ -40,7 +57,11 @@ "parent_id": "Root.SampleSEooC", "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 20 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/port_directional_interface_binding/output.json b/plantuml/parser/integration_test/component_diagram/port_directional_interface_binding/output.json index bd9b977d..dbda8fef 100644 --- a/plantuml/parser/integration_test/component_diagram/port_directional_interface_binding/output.json +++ b/plantuml/parser/integration_test/component_diagram/port_directional_interface_binding/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "Pkg.Client": { "id": "Pkg.Client", @@ -21,15 +25,27 @@ "target": "Pkg.IProvided", "annotation": "provides", "relation_type": "InterfaceBinding", - "source_role": "Provided" + "source_role": "Provided", + "source_location": { + "file": "", + "line": 25 + } }, { "target": "Pkg.IRequired", "annotation": "requires", "relation_type": "InterfaceBinding", - "source_role": "Required" + "source_role": "Required", + "source_location": { + "file": "", + "line": 26 + } } - ] + ], + "source_location": { + "file": "", + "line": 16 + } }, "Pkg.IProvided": { "id": "Pkg.IProvided", @@ -38,7 +54,11 @@ "parent_id": "Pkg", "comp_type": "Interface", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 22 + } }, "Pkg.IRequired": { "id": "Pkg.IRequired", @@ -47,7 +67,11 @@ "parent_id": "Pkg", "comp_type": "Interface", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 23 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/port_global_name_resolution/output.json b/plantuml/parser/integration_test/component_diagram/port_global_name_resolution/output.json index 6b788530..577dbeec 100644 --- a/plantuml/parser/integration_test/component_diagram/port_global_name_resolution/output.json +++ b/plantuml/parser/integration_test/component_diagram/port_global_name_resolution/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 19 + } }, "SampleSEooC.ClientComp": { "id": "SampleSEooC.ClientComp", @@ -20,9 +24,18 @@ { "target": "SampleSEooC.ServerComp", "annotation": "calls", - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 28 + } } - ] + ], + "source_location": { + "file": "", + "line": 20 + } }, "SampleSEooC.ServerComp": { "id": "SampleSEooC.ServerComp", @@ -31,7 +44,11 @@ "parent_id": "SampleSEooC", "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 23 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/port_relation_lifting/output.json b/plantuml/parser/integration_test/component_diagram/port_relation_lifting/output.json index b45d810c..7343eb0a 100644 --- a/plantuml/parser/integration_test/component_diagram/port_relation_lifting/output.json +++ b/plantuml/parser/integration_test/component_diagram/port_relation_lifting/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "SampleSEooC.ClientComp": { "id": "SampleSEooC.ClientComp", @@ -20,9 +24,18 @@ { "target": "SampleSEooC.ServerComp", "annotation": "calls", - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 22 + } } - ] + ], + "source_location": { + "file": "", + "line": 16 + } }, "SampleSEooC.ServerComp": { "id": "SampleSEooC.ServerComp", @@ -31,7 +44,11 @@ "parent_id": "SampleSEooC", "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 19 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/port_target_no_decor_no_mismatch/output.json b/plantuml/parser/integration_test/component_diagram/port_target_no_decor_no_mismatch/output.json index a1825660..b632c2ca 100644 --- a/plantuml/parser/integration_test/component_diagram/port_target_no_decor_no_mismatch/output.json +++ b/plantuml/parser/integration_test/component_diagram/port_target_no_decor_no_mismatch/output.json @@ -12,9 +12,17 @@ "target": "Server", "annotation": "calls", "relation_type": "Dependency", - "source_role": "None" + "source_role": "None", + "source_location": { + "file": "", + "line": 24 + } } - ] + ], + "source_location": { + "file": "", + "line": 15 + } }, "Server": { "id": "Server", @@ -23,7 +31,11 @@ "parent_id": null, "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 19 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/port_two_ports/output.json b/plantuml/parser/integration_test/component_diagram/port_two_ports/output.json index 5edc6b07..4fbdf229 100644 --- a/plantuml/parser/integration_test/component_diagram/port_two_ports/output.json +++ b/plantuml/parser/integration_test/component_diagram/port_two_ports/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "SampleSEooC.ClientComp": { "id": "SampleSEooC.ClientComp", @@ -20,9 +24,18 @@ { "target": "SampleSEooC.ServerComp", "annotation": "calls", - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 22 + } } - ] + ], + "source_location": { + "file": "", + "line": 16 + } }, "SampleSEooC.ServerComp": { "id": "SampleSEooC.ServerComp", @@ -31,7 +44,11 @@ "parent_id": "SampleSEooC", "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 19 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/relation_absolute_fqn/output.json b/plantuml/parser/integration_test/component_diagram/relation_absolute_fqn/output.json index 2bda6d76..56929880 100644 --- a/plantuml/parser/integration_test/component_diagram/relation_absolute_fqn/output.json +++ b/plantuml/parser/integration_test/component_diagram/relation_absolute_fqn/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "PkgA.ComponentA": { "id": "PkgA.ComponentA", @@ -16,7 +20,11 @@ "parent_id": "PkgA", "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 16 + } }, "PkgB": { "id": "PkgB", @@ -25,7 +33,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 20 + } }, "PkgB.ComponentB": { "id": "PkgB.ComponentB", @@ -38,9 +50,18 @@ { "target": "PkgA.ComponentA", "annotation": "uses", - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 24 + } } - ] + ], + "source_location": { + "file": "", + "line": 21 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/relation_fqn/output.json b/plantuml/parser/integration_test/component_diagram/relation_fqn/output.json index a6e08082..c86eae7b 100644 --- a/plantuml/parser/integration_test/component_diagram/relation_fqn/output.json +++ b/plantuml/parser/integration_test/component_diagram/relation_fqn/output.json @@ -1,6 +1,5 @@ { - "relation_fqn.puml": - { + "relation_fqn.puml": { "SampleSEooC.ComponentB.UnitB": { "id": "SampleSEooC.ComponentB.UnitB", "name": "Unit B", @@ -8,7 +7,11 @@ "parent_id": "SampleSEooC.ComponentB", "comp_type": "Component", "stereotype": "unit", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 21 + } }, "SampleSEooC.ComponentA.UnitA": { "id": "SampleSEooC.ComponentA.UnitA", @@ -21,9 +24,18 @@ { "target": "SampleSEooC.ComponentB.UnitB", "annotation": "uses", - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 26 + } } - ] + ], + "source_location": { + "file": "", + "line": 17 + } }, "SampleSEooC": { "id": "SampleSEooC", @@ -32,7 +44,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "SampleSEooC.ComponentA": { "id": "SampleSEooC.ComponentA", @@ -41,7 +57,11 @@ "parent_id": "SampleSEooC", "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 16 + } }, "SampleSEooC.ComponentB": { "id": "SampleSEooC.ComponentB", @@ -50,7 +70,11 @@ "parent_id": "SampleSEooC", "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 20 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/relation_interface_provided_to_component/output.json b/plantuml/parser/integration_test/component_diagram/relation_interface_provided_to_component/output.json index 9643199b..0823254c 100644 --- a/plantuml/parser/integration_test/component_diagram/relation_interface_provided_to_component/output.json +++ b/plantuml/parser/integration_test/component_diagram/relation_interface_provided_to_component/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "Pkg.IProvided": { "id": "Pkg.IProvided", @@ -16,7 +20,11 @@ "parent_id": "Pkg", "comp_type": "Interface", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 16 + } }, "Pkg.A": { "id": "Pkg.A", @@ -30,9 +38,17 @@ "target": "Pkg.IProvided", "annotation": "provides", "relation_type": "InterfaceBinding", - "source_role": "Provided" + "source_role": "Provided", + "source_location": { + "file": "", + "line": 19 + } } - ] + ], + "source_location": { + "file": "", + "line": 17 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/relation_interface_required_to_component/output.json b/plantuml/parser/integration_test/component_diagram/relation_interface_required_to_component/output.json index b0ff0276..3fb05b36 100644 --- a/plantuml/parser/integration_test/component_diagram/relation_interface_required_to_component/output.json +++ b/plantuml/parser/integration_test/component_diagram/relation_interface_required_to_component/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "Pkg.IReq": { "id": "Pkg.IReq", @@ -16,7 +20,11 @@ "parent_id": "Pkg", "comp_type": "Interface", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 16 + } }, "Pkg.A": { "id": "Pkg.A", @@ -30,9 +38,17 @@ "target": "Pkg.IReq", "annotation": "requires", "relation_type": "InterfaceBinding", - "source_role": "Required" + "source_role": "Required", + "source_location": { + "file": "", + "line": 19 + } } - ] + ], + "source_location": { + "file": "", + "line": 17 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/relation_invalid_arrow_parsed_as_association/output.json b/plantuml/parser/integration_test/component_diagram/relation_invalid_arrow_parsed_as_association/output.json index 2c1be723..275736a5 100644 --- a/plantuml/parser/integration_test/component_diagram/relation_invalid_arrow_parsed_as_association/output.json +++ b/plantuml/parser/integration_test/component_diagram/relation_invalid_arrow_parsed_as_association/output.json @@ -11,9 +11,18 @@ { "target": "Pkg.IService", "annotation": "association", - "relation_type": "Association" + "relation_type": "Association", + "source_role": "None", + "source_location": { + "file": "", + "line": 19 + } } - ] + ], + "source_location": { + "file": "", + "line": 16 + } }, "Pkg.IService": { "id": "Pkg.IService", @@ -22,7 +31,11 @@ "parent_id": "Pkg", "comp_type": "Interface", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 17 + } }, "Pkg": { "id": "Pkg", @@ -31,7 +44,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/relation_relative_name/output.json b/plantuml/parser/integration_test/component_diagram/relation_relative_name/output.json index 58390b74..ddf90a39 100644 --- a/plantuml/parser/integration_test/component_diagram/relation_relative_name/output.json +++ b/plantuml/parser/integration_test/component_diagram/relation_relative_name/output.json @@ -7,7 +7,11 @@ "parent_id": "SampleSEooC.ComponentB", "comp_type": "Component", "stereotype": "unit", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 21 + } }, "SampleSEooC": { "id": "SampleSEooC", @@ -16,7 +20,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "SampleSEooC.ComponentA.UnitA": { "id": "SampleSEooC.ComponentA.UnitA", @@ -29,9 +37,18 @@ { "target": "SampleSEooC.ComponentB.UnitB", "annotation": "uses", - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 25 + } } - ] + ], + "source_location": { + "file": "", + "line": 17 + } }, "SampleSEooC.ComponentB": { "id": "SampleSEooC.ComponentB", @@ -40,7 +57,11 @@ "parent_id": "SampleSEooC", "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 20 + } }, "SampleSEooC.ComponentA": { "id": "SampleSEooC.ComponentA", @@ -49,7 +70,11 @@ "parent_id": "SampleSEooC", "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 16 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/relation_reverse_simple_name/output.json b/plantuml/parser/integration_test/component_diagram/relation_reverse_simple_name/output.json index fc0419f2..e14b4df3 100644 --- a/plantuml/parser/integration_test/component_diagram/relation_reverse_simple_name/output.json +++ b/plantuml/parser/integration_test/component_diagram/relation_reverse_simple_name/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "SampleSEooC.ComponentA": { "id": "SampleSEooC.ComponentA", @@ -20,9 +24,18 @@ { "target": "SampleSEooC.ComponentB", "annotation": null, - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 21 + } } - ] + ], + "source_location": { + "file": "", + "line": 16 + } }, "SampleSEooC.ComponentB": { "id": "SampleSEooC.ComponentB", @@ -31,7 +44,11 @@ "parent_id": "SampleSEooC", "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 18 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/relation_simple_name/output.json b/plantuml/parser/integration_test/component_diagram/relation_simple_name/output.json index 81616daa..6375fe0e 100644 --- a/plantuml/parser/integration_test/component_diagram/relation_simple_name/output.json +++ b/plantuml/parser/integration_test/component_diagram/relation_simple_name/output.json @@ -7,7 +7,11 @@ "parent_id": "SampleSEooC", "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 20 + } }, "SampleSEooC": { "id": "SampleSEooC", @@ -16,7 +20,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "SampleSEooC.ComponentA": { "id": "SampleSEooC.ComponentA", @@ -29,14 +37,28 @@ { "target": "SampleSEooC.ComponentA.UnitA", "annotation": "uses", - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 24 + } }, { "target": "SampleSEooC.ComponentB", "annotation": "uses", - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 25 + } } - ] + ], + "source_location": { + "file": "", + "line": 16 + } }, "SampleSEooC.ComponentB.UnitB": { "id": "SampleSEooC.ComponentB.UnitB", @@ -45,7 +67,11 @@ "parent_id": "SampleSEooC.ComponentB", "comp_type": "Component", "stereotype": "unit", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 21 + } }, "SampleSEooC.ComponentA.UnitA": { "id": "SampleSEooC.ComponentA.UnitA", @@ -54,7 +80,11 @@ "parent_id": "SampleSEooC.ComponentA", "comp_type": "Component", "stereotype": "unit", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 17 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/relation_simple_name_alias/output.json b/plantuml/parser/integration_test/component_diagram/relation_simple_name_alias/output.json index 9be672da..c483867c 100644 --- a/plantuml/parser/integration_test/component_diagram/relation_simple_name_alias/output.json +++ b/plantuml/parser/integration_test/component_diagram/relation_simple_name_alias/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "PkgA.AliasA": { "id": "PkgA.AliasA", @@ -20,9 +24,18 @@ { "target": "PkgB.AliasB", "annotation": "uses", - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 25 + } } - ] + ], + "source_location": { + "file": "", + "line": 16 + } }, "PkgB": { "id": "PkgB", @@ -31,7 +44,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 20 + } }, "PkgB.AliasB": { "id": "PkgB.AliasB", @@ -40,7 +57,11 @@ "parent_id": "PkgB", "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 21 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/together_basic/output.json b/plantuml/parser/integration_test/component_diagram/together_basic/output.json index ff979946..23e4e0c7 100644 --- a/plantuml/parser/integration_test/component_diagram/together_basic/output.json +++ b/plantuml/parser/integration_test/component_diagram/together_basic/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "SampleSEooC.ComponentA": { "id": "SampleSEooC.ComponentA", @@ -16,7 +20,11 @@ "parent_id": "SampleSEooC", "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 17 + } }, "SampleSEooC.ComponentB": { "id": "SampleSEooC.ComponentB", @@ -25,7 +33,11 @@ "parent_id": "SampleSEooC", "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 19 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/together_with_relation/output.json b/plantuml/parser/integration_test/component_diagram/together_with_relation/output.json index e72dc8b2..9c66cdd2 100644 --- a/plantuml/parser/integration_test/component_diagram/together_with_relation/output.json +++ b/plantuml/parser/integration_test/component_diagram/together_with_relation/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "SampleSEooC.ComponentA": { "id": "SampleSEooC.ComponentA", @@ -20,9 +24,18 @@ { "target": "SampleSEooC.ComponentB", "annotation": "depends", - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 22 + } } - ] + ], + "source_location": { + "file": "", + "line": 17 + } }, "SampleSEooC.ComponentB": { "id": "SampleSEooC.ComponentB", @@ -31,7 +44,11 @@ "parent_id": "SampleSEooC", "comp_type": "Component", "stereotype": "component", - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 19 + } } } } diff --git a/plantuml/parser/integration_test/component_diagram/top_level_port/output.json b/plantuml/parser/integration_test/component_diagram/top_level_port/output.json index a056d685..bd4a3032 100644 --- a/plantuml/parser/integration_test/component_diagram/top_level_port/output.json +++ b/plantuml/parser/integration_test/component_diagram/top_level_port/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Interface", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 20 + } }, "ClientComp": { "id": "ClientComp", @@ -20,9 +24,18 @@ { "target": "ExternalAPI", "annotation": "sends", - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 26 + } } - ] + ], + "source_location": { + "file": "", + "line": 22 + } } } } diff --git a/plantuml/parser/integration_test/deployment_diagram/arrows_link/output.json b/plantuml/parser/integration_test/deployment_diagram/arrows_link/output.json index d5479325..9c0d8a38 100644 --- a/plantuml/parser/integration_test/deployment_diagram/arrows_link/output.json +++ b/plantuml/parser/integration_test/deployment_diagram/arrows_link/output.json @@ -11,24 +11,48 @@ { "target": "host_b", "annotation": "mark_a", - "relation_type": "None" + "relation_type": "Association", + "source_role": "None", + "source_location": { + "file": "", + "line": 20 + } }, { "target": "host_c", "annotation": "mark_b", - "relation_type": "None" + "relation_type": "Association", + "source_role": "None", + "source_location": { + "file": "", + "line": 21 + } }, { "target": "host_d", "annotation": "mark_c", - "relation_type": "None" + "relation_type": "Association", + "source_role": "None", + "source_location": { + "file": "", + "line": 22 + } }, { "target": "host_e", "annotation": null, - "relation_type": "None" + "relation_type": "Association", + "source_role": "None", + "source_location": { + "file": "", + "line": 23 + } } - ] + ], + "source_location": { + "file": "", + "line": 15 + } }, "host_b": { "id": "host_b", @@ -37,7 +61,11 @@ "parent_id": null, "comp_type": "Node", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 16 + } }, "host_c": { "id": "host_c", @@ -46,7 +74,11 @@ "parent_id": null, "comp_type": "Node", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 17 + } }, "host_d": { "id": "host_d", @@ -55,7 +87,11 @@ "parent_id": null, "comp_type": "Node", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 18 + } }, "host_e": { "id": "host_e", @@ -64,7 +100,11 @@ "parent_id": null, "comp_type": "Node", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 19 + } }, "bundle_a": { "id": "bundle_a", @@ -77,51 +117,98 @@ { "target": "bundle_b", "annotation": null, - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 35 + } }, { "target": "bundle_c", "annotation": null, - "relation_type": "None" + "relation_type": "Association", + "source_role": "None", + "source_location": { + "file": "", + "line": 36 + } }, { "target": "bundle_d", "annotation": null, - "relation_type": "None" + "relation_type": "Association", + "source_role": "None", + "source_location": { + "file": "", + "line": 37 + } }, { "target": "bundle_e", "annotation": null, - "relation_type": "None" + "relation_type": "Association", + "source_role": "None", + "source_location": { + "file": "", + "line": 38 + } }, { "target": "bundle_f", "annotation": null, - "relation_type": "None" + "relation_type": "Association", + "source_role": "None", + "source_location": { + "file": "", + "line": 39 + } }, { "target": "bundle_g", "annotation": null, - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 40 + } }, { "target": "bundle_h", "annotation": null, - "relation_type": "None" + "relation_type": "Association", + "source_role": "None", + "source_location": { + "file": "", + "line": 41 + } }, { "target": "bundle_i", "annotation": null, - "relation_type": "None" + "relation_type": "Association", + "source_role": "None", + "source_location": { + "file": "", + "line": 42 + } }, { "target": "bundle_j", "annotation": null, "relation_type": "Association", - "source_endpoint": "Component", - "target_endpoint": "Component" + "source_role": "None", + "source_location": { + "file": "", + "line": 43 + } } - ] + ], + "source_location": { + "file": "", + "line": 25 + } }, "bundle_b": { "id": "bundle_b", @@ -130,7 +217,11 @@ "parent_id": null, "comp_type": "Artifact", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 26 + } }, "bundle_c": { "id": "bundle_c", @@ -139,7 +230,11 @@ "parent_id": null, "comp_type": "Artifact", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 27 + } }, "bundle_d": { "id": "bundle_d", @@ -148,7 +243,11 @@ "parent_id": null, "comp_type": "Artifact", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 28 + } }, "bundle_e": { "id": "bundle_e", @@ -157,7 +256,11 @@ "parent_id": null, "comp_type": "Artifact", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 29 + } }, "bundle_f": { "id": "bundle_f", @@ -166,7 +269,11 @@ "parent_id": null, "comp_type": "Artifact", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 30 + } }, "bundle_g": { "id": "bundle_g", @@ -175,7 +282,11 @@ "parent_id": null, "comp_type": "Artifact", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 31 + } }, "bundle_h": { "id": "bundle_h", @@ -184,7 +295,11 @@ "parent_id": null, "comp_type": "Artifact", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 32 + } }, "bundle_i": { "id": "bundle_i", @@ -193,7 +308,11 @@ "parent_id": null, "comp_type": "Artifact", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 33 + } }, "bundle_j": { "id": "bundle_j", @@ -202,7 +321,11 @@ "parent_id": null, "comp_type": "Artifact", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 34 + } } } } diff --git a/plantuml/parser/integration_test/deployment_diagram/declare_elements/output.json b/plantuml/parser/integration_test/deployment_diagram/declare_elements/output.json index 34ea7b91..2ed52361 100644 --- a/plantuml/parser/integration_test/deployment_diagram/declare_elements/output.json +++ b/plantuml/parser/integration_test/deployment_diagram/declare_elements/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Actor", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 16 + } }, "role_b": { "id": "role_b", @@ -16,7 +20,11 @@ "parent_id": null, "comp_type": "Agent", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 17 + } }, "item_a": { "id": "item_a", @@ -25,7 +33,11 @@ "parent_id": null, "comp_type": "Artifact", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 18 + } }, "zone_a": { "id": "zone_a", @@ -34,7 +46,11 @@ "parent_id": null, "comp_type": "Boundary", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 19 + } }, "item_b": { "id": "item_b", @@ -43,7 +59,11 @@ "parent_id": null, "comp_type": "Card", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 20 + } }, "zone_b": { "id": "zone_b", @@ -52,7 +72,11 @@ "parent_id": null, "comp_type": "Cloud", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 21 + } }, "part_a": { "id": "part_a", @@ -61,7 +85,11 @@ "parent_id": null, "comp_type": "Component", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 22 + } }, "part_b": { "id": "part_b", @@ -70,7 +98,11 @@ "parent_id": null, "comp_type": "Control", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 23 + } }, "store_a": { "id": "store_a", @@ -79,7 +111,11 @@ "parent_id": null, "comp_type": "Database", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 24 + } }, "record_a": { "id": "record_a", @@ -88,7 +124,11 @@ "parent_id": null, "comp_type": "Entity", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 25 + } }, "doc_a": { "id": "doc_a", @@ -97,7 +137,11 @@ "parent_id": null, "comp_type": "File", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 26 + } }, "dir_a": { "id": "dir_a", @@ -106,7 +150,11 @@ "parent_id": null, "comp_type": "Folder", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 27 + } }, "zone_c": { "id": "zone_c", @@ -115,7 +163,11 @@ "parent_id": null, "comp_type": "Frame", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 28 + } }, "port_a": { "id": "port_a", @@ -124,7 +176,11 @@ "parent_id": null, "comp_type": "Interface", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 29 + } }, "host_a": { "id": "host_a", @@ -133,7 +189,11 @@ "parent_id": null, "comp_type": "Node", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 30 + } }, "pack_a": { "id": "pack_a", @@ -142,7 +202,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 31 + } }, "lane_a": { "id": "lane_a", @@ -151,7 +215,11 @@ "parent_id": null, "comp_type": "Queue", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 32 + } }, "lane_b": { "id": "lane_b", @@ -160,7 +228,11 @@ "parent_id": null, "comp_type": "Stack", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 33 + } }, "box_a": { "id": "box_a", @@ -169,7 +241,11 @@ "parent_id": null, "comp_type": "Rectangle", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 34 + } }, "store_b": { "id": "store_b", @@ -178,7 +254,11 @@ "parent_id": null, "comp_type": "Storage", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 35 + } }, "case_a": { "id": "case_a", @@ -187,7 +267,11 @@ "parent_id": null, "comp_type": "Usecase", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 36 + } } } } diff --git a/plantuml/parser/integration_test/deployment_diagram/deployment_diagram_it/output.json b/plantuml/parser/integration_test/deployment_diagram/deployment_diagram_it/output.json index e41ef937..32230a74 100644 --- a/plantuml/parser/integration_test/deployment_diagram/deployment_diagram_it/output.json +++ b/plantuml/parser/integration_test/deployment_diagram/deployment_diagram_it/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "aaa.Driver": { "id": "aaa.Driver", @@ -20,9 +24,18 @@ { "target": "aaa.ECU2.DisplayService", "annotation": null, - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 34 + } } - ] + ], + "source_location": { + "file": "", + "line": 16 + } }, "aaa.ECU1": { "id": "aaa.ECU1", @@ -31,7 +44,11 @@ "parent_id": "aaa", "comp_type": "Node", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 18 + } }, "aaa.ECU1.someip": { "id": "aaa.ECU1.someip", @@ -44,9 +61,18 @@ { "target": "aaa.ECU1.SpeedService", "annotation": null, - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 36 + } } - ] + ], + "source_location": { + "file": "", + "line": 20 + } }, "aaa.ECU1.SpeedService": { "id": "aaa.ECU1.SpeedService", @@ -59,9 +85,18 @@ { "target": "aaa.ECU1.VehicleSpeed", "annotation": null, - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 37 + } } - ] + ], + "source_location": { + "file": "", + "line": 22 + } }, "aaa.ECU1.VehicleSpeed": { "id": "aaa.ECU1.VehicleSpeed", @@ -70,7 +105,11 @@ "parent_id": "aaa.ECU1", "comp_type": "Entity", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 24 + } }, "aaa.ECU2": { "id": "aaa.ECU2", @@ -79,7 +118,11 @@ "parent_id": "aaa", "comp_type": "Node", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 28 + } }, "aaa.ECU2.DisplayService": { "id": "aaa.ECU2.DisplayService", @@ -92,9 +135,18 @@ { "target": "aaa.ECU1.someip", "annotation": null, - "relation_type": "Dependency" + "relation_type": "Dependency", + "source_role": "None", + "source_location": { + "file": "", + "line": 35 + } } - ] + ], + "source_location": { + "file": "", + "line": 30 + } } } } diff --git a/plantuml/parser/integration_test/deployment_diagram/nested_elements/output.json b/plantuml/parser/integration_test/deployment_diagram/nested_elements/output.json index e6cda8f6..63f22ec2 100644 --- a/plantuml/parser/integration_test/deployment_diagram/nested_elements/output.json +++ b/plantuml/parser/integration_test/deployment_diagram/nested_elements/output.json @@ -7,7 +7,11 @@ "parent_id": null, "comp_type": "Artifact", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 15 + } }, "item_a.item_b": { "id": "item_a.item_b", @@ -16,7 +20,11 @@ "parent_id": "item_a", "comp_type": "Card", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 16 + } }, "item_a.item_b.zone_a": { "id": "item_a.item_b.zone_a", @@ -25,7 +33,11 @@ "parent_id": "item_a.item_b", "comp_type": "Cloud", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 17 + } }, "item_a.item_b.zone_a.part_a": { "id": "item_a.item_b.zone_a.part_a", @@ -34,7 +46,11 @@ "parent_id": "item_a.item_b.zone_a", "comp_type": "Component", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 18 + } }, "item_a.item_b.zone_a.part_a.store_a": { "id": "item_a.item_b.zone_a.part_a.store_a", @@ -43,7 +59,11 @@ "parent_id": "item_a.item_b.zone_a.part_a", "comp_type": "Database", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 19 + } }, "item_a.item_b.zone_a.part_a.store_a.doc_a": { "id": "item_a.item_b.zone_a.part_a.store_a.doc_a", @@ -52,7 +72,11 @@ "parent_id": "item_a.item_b.zone_a.part_a.store_a", "comp_type": "File", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 20 + } }, "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a": { "id": "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a", @@ -61,7 +85,11 @@ "parent_id": "item_a.item_b.zone_a.part_a.store_a.doc_a", "comp_type": "Folder", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 21 + } }, "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b": { "id": "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b", @@ -70,7 +98,11 @@ "parent_id": "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a", "comp_type": "Frame", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 22 + } }, "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a": { "id": "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a", @@ -79,7 +111,11 @@ "parent_id": "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b", "comp_type": "Hexagon", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 23 + } }, "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a.host_a": { "id": "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a.host_a", @@ -88,7 +124,11 @@ "parent_id": "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a", "comp_type": "Node", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 24 + } }, "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a.host_a.pack_a": { "id": "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a.host_a.pack_a", @@ -97,7 +137,11 @@ "parent_id": "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a.host_a", "comp_type": "Package", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 25 + } }, "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a.host_a.pack_a.lane_a": { "id": "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a.host_a.pack_a.lane_a", @@ -106,7 +150,11 @@ "parent_id": "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a.host_a.pack_a", "comp_type": "Queue", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 26 + } }, "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a.host_a.pack_a.lane_a.box_a": { "id": "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a.host_a.pack_a.lane_a.box_a", @@ -115,7 +163,11 @@ "parent_id": "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a.host_a.pack_a.lane_a", "comp_type": "Rectangle", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 27 + } }, "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a.host_a.pack_a.lane_a.box_a.lane_b": { "id": "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a.host_a.pack_a.lane_a.box_a.lane_b", @@ -124,7 +176,11 @@ "parent_id": "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a.host_a.pack_a.lane_a.box_a", "comp_type": "Stack", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 28 + } }, "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a.host_a.pack_a.lane_a.box_a.lane_b.store_b": { "id": "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a.host_a.pack_a.lane_a.box_a.lane_b.store_b", @@ -133,7 +189,11 @@ "parent_id": "item_a.item_b.zone_a.part_a.store_a.doc_a.dir_a.zone_b.cell_a.host_a.pack_a.lane_a.box_a.lane_b", "comp_type": "Storage", "stereotype": null, - "relations": [] + "relations": [], + "source_location": { + "file": "", + "line": 29 + } } } } diff --git a/plantuml/parser/integration_test/src/test_framework.rs b/plantuml/parser/integration_test/src/test_framework.rs index 71c77b70..de5459cf 100644 --- a/plantuml/parser/integration_test/src/test_framework.rs +++ b/plantuml/parser/integration_test/src/test_framework.rs @@ -162,7 +162,15 @@ where ); } Expected::Ast(expected_ast) => { - assert_eq!(actual, expected_ast, "AST output mismatch"); + let mut actual_json = + serde_json::to_value(actual).expect("Failed to serialize actual AST"); + let mut expected_json = + serde_json::to_value(expected_ast).expect("Failed to serialize expected AST"); + + normalize_source_location_fields(&mut actual_json); + normalize_source_location_fields(&mut expected_json); + + assert_eq!(actual_json, expected_json, "AST output mismatch"); } } } @@ -173,6 +181,23 @@ where } } +fn normalize_source_location_fields(value: &mut JsonValue) { + match value { + JsonValue::Object(map) => { + map.remove("file"); + for child in map.values_mut() { + normalize_source_location_fields(child); + } + } + JsonValue::Array(items) => { + for item in items { + normalize_source_location_fields(item); + } + } + _ => {} + } +} + // =================== Error Matcher =================== fn assert_projected_error_matches_yaml(err: &ProjectedError, expected: &YamlValue) { let expected_type = expected From 9f6b219fa4396fb9be79e5cf4f883bc8967b2d20 Mon Sep 17 00:00:00 2001 From: Xian Gu Date: Wed, 8 Jul 2026 14:37:17 +0800 Subject: [PATCH 3/4] add source location for sequence --- .../puml_parser/src/sequence_diagram/BUILD | 1 + .../src/sequence_diagram/src/syntax_ast.rs | 4 + .../src/sequence_diagram/src/syntax_parser.rs | 73 ++++++++++++++++-- .../src/sequence_diagram/src/logic_parser.rs | 3 + .../sequence_diagram/src/sequence_resolver.rs | 50 +++++++++++++ tools/metamodel/sequence/BUILD | 1 + tools/metamodel/sequence/sequence_logic.rs | 2 + .../flatbuffers/sequence/sequence_diagram.fbs | 11 ++- .../sequence/sequence_serializer.rs | 16 ++-- .../src/models/sequence_diagram_models.rs | 75 +++++++++++++------ .../src/readers/sequence_diagram_reader.rs | 6 +- .../sequence_internal_api_validator.rs | 8 ++ .../src/validators/shared/diagram_analysis.rs | 4 + .../core/src/validators/test/fixtures.rs | 1 + 14 files changed, 216 insertions(+), 39 deletions(-) diff --git a/plantuml/parser/puml_parser/src/sequence_diagram/BUILD b/plantuml/parser/puml_parser/src/sequence_diagram/BUILD index e66eb2a3..3eaad808 100644 --- a/plantuml/parser/puml_parser/src/sequence_diagram/BUILD +++ b/plantuml/parser/puml_parser/src/sequence_diagram/BUILD @@ -29,6 +29,7 @@ rust_library( deps = [ "//plantuml/parser/puml_parser:parser_core", "//plantuml/parser/puml_utils", + "//tools/metamodel/common:source_location", "@crates//:log", "@crates//:pest", "@crates//:serde", diff --git a/plantuml/parser/puml_parser/src/sequence_diagram/src/syntax_ast.rs b/plantuml/parser/puml_parser/src/sequence_diagram/src/syntax_ast.rs index 2356c1a8..cabd8bb8 100644 --- a/plantuml/parser/puml_parser/src/sequence_diagram/src/syntax_ast.rs +++ b/plantuml/parser/puml_parser/src/sequence_diagram/src/syntax_ast.rs @@ -13,6 +13,7 @@ // AST types for PlantUML Sequence Diagram Parser use serde::{Deserialize, Serialize}; +use source_location::SourceLocation; pub use parser_core::common_ast::Arrow; @@ -41,6 +42,7 @@ pub struct ParticipantDef { pub participant_type: ParticipantType, pub identifier: ParticipantIdentifier, pub stereotype: Option, + pub source_location: SourceLocation, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] @@ -93,6 +95,7 @@ pub struct Message { #[serde(skip_serializing_if = "Option::is_none")] pub activation_marker: Option, pub description: Option, + pub source_location: SourceLocation, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -115,6 +118,7 @@ pub enum ActivationType { pub struct GroupCmd { pub group_type: GroupType, pub text: Option, + pub source_location: SourceLocation, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] diff --git a/plantuml/parser/puml_parser/src/sequence_diagram/src/syntax_parser.rs b/plantuml/parser/puml_parser/src/sequence_diagram/src/syntax_parser.rs index 9982e7e2..866bb7b3 100644 --- a/plantuml/parser/puml_parser/src/sequence_diagram/src/syntax_parser.rs +++ b/plantuml/parser/puml_parser/src/sequence_diagram/src/syntax_parser.rs @@ -17,6 +17,7 @@ use parser_core::{ format_parse_tree, pest_to_syntax_error, BaseParseError, DiagramParser, ErrorLocation, }; use puml_utils::LogLevel; +use source_location::SourceLocation; use std::path::PathBuf; use std::rc::Rc; use thiserror::Error; @@ -57,17 +58,27 @@ impl PumlSequenceParser { None } - fn parse_statement(pair: pest::iterators::Pair) -> Result, SequenceError> { + fn parse_statement( + pair: pest::iterators::Pair, + source_path: &str, + ) -> Result, SequenceError> { + let source_location = SourceLocation::new(source_path, pair.line_col().0 as u32); let inner = pair .into_inner() .next() .ok_or_else(|| SequenceError::InvalidStatement("empty statement".to_string()))?; match inner.as_rule() { Rule::participant_def => Ok(vec![Statement::ParticipantDef( - Self::parse_participant_def(inner)?, + Self::parse_participant_def(inner, source_location)?, )]), - Rule::message => Ok(vec![Statement::Message(Self::parse_message(inner)?)]), - Rule::group_cmd => Ok(vec![Statement::GroupCmd(Self::parse_group_cmd(inner)?)]), + Rule::message => Ok(vec![Statement::Message(Self::parse_message( + inner, + source_location, + )?)]), + Rule::group_cmd => Ok(vec![Statement::GroupCmd(Self::parse_group_cmd( + inner, + source_location, + )?)]), Rule::destroy_cmd => Ok(vec![Statement::DestroyCmd(Self::parse_destroy_cmd(inner)?)]), Rule::create_cmd => Ok(vec![Statement::CreateCmd(Self::parse_create_cmd(inner)?)]), Rule::activate_cmd => Ok(vec![Statement::ActivateCmd(Self::parse_activate_cmd( @@ -83,6 +94,7 @@ impl PumlSequenceParser { fn parse_participant_def( pair: pest::iterators::Pair, + source_location: SourceLocation, ) -> Result { let mut participant_type: Option = None; let mut identifier: Option = None; @@ -182,6 +194,7 @@ impl PumlSequenceParser { SequenceError::InvalidStatement("missing participant identifier".to_string()) })?, stereotype, + source_location, }) } @@ -200,7 +213,10 @@ impl PumlSequenceParser { } } - fn parse_message(pair: pest::iterators::Pair) -> Result { + fn parse_message( + pair: pest::iterators::Pair, + source_location: SourceLocation, + ) -> Result { let mut left: Option = None; let mut arrow: Option = None; let mut right: Option = None; @@ -246,6 +262,7 @@ impl PumlSequenceParser { content, activation_marker, description, + source_location, }) } @@ -254,7 +271,10 @@ impl PumlSequenceParser { .map_err(|e| SequenceError::InvalidStatement(format!("invalid arrow: {}", e))) } - fn parse_group_cmd(pair: pest::iterators::Pair) -> Result { + fn parse_group_cmd( + pair: pest::iterators::Pair, + source_location: SourceLocation, + ) -> Result { let mut group_type: Option = None; let mut text: Option = None; @@ -274,6 +294,7 @@ impl PumlSequenceParser { group_type: group_type .ok_or_else(|| SequenceError::InvalidStatement("missing group type".to_string()))?, text, + source_location, }) } @@ -447,6 +468,7 @@ impl DiagramParser for PumlSequenceParser { ); } + let source_path = path.as_ref().clone().to_string_lossy().to_string(); let mut document = SeqPumlDocument { name: None, statements: Vec::new(), @@ -460,7 +482,7 @@ impl DiagramParser for PumlSequenceParser { document.name = Self::parse_startuml(inner_pair); } Rule::sequence_statement => { - let mut stmts = Self::parse_statement(inner_pair)?; + let mut stmts = Self::parse_statement(inner_pair, &source_path)?; document.statements.append(&mut stmts); } Rule::empty_line => { @@ -540,4 +562,41 @@ mod dispatch_style_tests { .expect("valid input must parse"); assert_eq!(doc.statements.len(), 3); } + + #[test] + fn test_source_locations_are_preserved() { + let input = "@startuml\nparticipant A\nparticipant B\nA -> B : call\n@enduml"; + let path = Rc::new(PathBuf::from("t.puml")); + let mut parser = PumlSequenceParser; + let doc = parser + .parse_file(&path, input, LogLevel::Info) + .expect("valid input must parse"); + + let expected_file = path.as_ref().clone().to_string_lossy().to_string(); + + let first_participant = match &doc.statements[0] { + Statement::ParticipantDef(participant) => participant, + actual => panic!( + "expected first statement to be a participant, got {:?}", + actual + ), + }; + + assert_eq!(first_participant.source_location.line, 2); + assert_eq!( + first_participant.source_location.file.as_ref(), + expected_file.as_str() + ); + + let message = match &doc.statements[2] { + Statement::Message(message) => message, + actual => panic!("expected third statement to be a message, got {:?}", actual), + }; + + assert_eq!(message.source_location.line, 4); + assert_eq!( + message.source_location.file.as_ref(), + expected_file.as_str() + ); + } } diff --git a/plantuml/parser/puml_resolver/src/sequence_diagram/src/logic_parser.rs b/plantuml/parser/puml_resolver/src/sequence_diagram/src/logic_parser.rs index d4705ebf..85e93592 100644 --- a/plantuml/parser/puml_resolver/src/sequence_diagram/src/logic_parser.rs +++ b/plantuml/parser/puml_resolver/src/sequence_diagram/src/logic_parser.rs @@ -130,6 +130,7 @@ fn build_group_node(statements: &[Statement], group: &GroupCmd) -> (SequenceNode ( SequenceNode { event: Event::Condition(condition), + source_location: group.source_location.clone(), branches_node: box_nodes(build_tree(&group_statements)), }, consumed, @@ -168,6 +169,7 @@ fn build_node(statements: &[Statement]) -> Option<(SequenceNode, usize)> { // Found our return - add it as the last branch node branches.push(SequenceNode { event: Event::Return(ret), + source_location: m.source_location.clone(), branches_node: Vec::new(), }); consumed = i + 1; @@ -212,6 +214,7 @@ fn build_node(statements: &[Statement]) -> Option<(SequenceNode, usize)> { Some(( SequenceNode { event, + source_location: msg.source_location.clone(), branches_node: branches, }, consumed, diff --git a/plantuml/parser/puml_resolver/src/sequence_diagram/src/sequence_resolver.rs b/plantuml/parser/puml_resolver/src/sequence_diagram/src/sequence_resolver.rs index b4e4f8c7..7a61ccf8 100644 --- a/plantuml/parser/puml_resolver/src/sequence_diagram/src/sequence_resolver.rs +++ b/plantuml/parser/puml_resolver/src/sequence_diagram/src/sequence_resolver.rs @@ -115,6 +115,7 @@ mod sequence_resolver_tests { use super::*; use parser_core::common_ast::{Arrow, ArrowDecor, ArrowLine}; use resolver_traits::DiagramResolver; + use sequence_logic::SourceLocation; use sequence_parser::syntax_ast::{ Message, MessageContent, ParticipantDef, ParticipantIdentifier, ParticipantType, Statement, }; @@ -154,6 +155,7 @@ mod sequence_resolver_tests { }, activation_marker: None, description: Some(label.to_string()), + source_location: SourceLocation::new("test.puml", 0), }) } @@ -166,6 +168,7 @@ mod sequence_resolver_tests { }, activation_marker: None, description: Some(label.to_string()), + source_location: SourceLocation::new("test.puml", 0), }) } @@ -234,6 +237,7 @@ mod sequence_resolver_tests { participant_type: ParticipantType::Participant, identifier: ParticipantIdentifier::Id(name.to_string()), stereotype: None, + source_location: SourceLocation::new("test.puml", 0), }) } @@ -301,4 +305,50 @@ mod sequence_resolver_tests { }; assert!(resolver.resolve(&doc).is_ok()); } + + /// Resolver output nodes must preserve source_location provenance. + #[test] + fn test_source_locations_are_preserved() { + let call_location = SourceLocation::new("sequence/provenance_case.puml", 42); + let return_location = SourceLocation::new("sequence/provenance_case.puml", 43); + + let stmts = vec![ + Statement::Message(Message { + content: MessageContent::WithTargets { + left: "A".to_string(), + arrow: solid_arrow(), + right: "B".to_string(), + }, + activation_marker: None, + description: Some("doWork".to_string()), + source_location: call_location.clone(), + }), + Statement::Message(Message { + content: MessageContent::WithTargets { + left: "B".to_string(), + arrow: dashed_arrow(), + right: "A".to_string(), + }, + activation_marker: None, + description: Some("result".to_string()), + source_location: return_location.clone(), + }), + ]; + + let mut resolver = SequenceResolver; + let doc = SeqPumlDocument { + name: Some("provenance".to_string()), + statements: stmts, + }; + + let tree = resolver.resolve(&doc).expect("must not fail"); + assert_eq!(tree.root_interactions.len(), 1); + + let interaction = &tree.root_interactions[0]; + assert_eq!(interaction.source_location, call_location); + + assert_eq!(interaction.branches_node.len(), 1); + let ret = &interaction.branches_node[0]; + assert_eq!(ret.source_location, return_location); + } } diff --git a/tools/metamodel/sequence/BUILD b/tools/metamodel/sequence/BUILD index 39f3fd7c..b068f5a9 100644 --- a/tools/metamodel/sequence/BUILD +++ b/tools/metamodel/sequence/BUILD @@ -22,6 +22,7 @@ rust_library( crate_root = "sequence_logic.rs", edition = "2021", deps = [ + "//tools/metamodel/common:source_location", "@crates//:serde", ], ) diff --git a/tools/metamodel/sequence/sequence_logic.rs b/tools/metamodel/sequence/sequence_logic.rs index 67528647..39b72288 100644 --- a/tools/metamodel/sequence/sequence_logic.rs +++ b/tools/metamodel/sequence/sequence_logic.rs @@ -12,6 +12,7 @@ // ******************************************************************************* use serde::{Deserialize, Serialize}; +pub use source_location::SourceLocation; /// A single item inside a function/branch/loop body, emitted in execution order. #[derive(Debug, Clone, Serialize, Deserialize)] @@ -92,6 +93,7 @@ pub enum Event { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SequenceNode { pub event: Event, + pub source_location: SourceLocation, pub branches_node: Vec, } diff --git a/tools/serialization/flatbuffers/sequence/sequence_diagram.fbs b/tools/serialization/flatbuffers/sequence/sequence_diagram.fbs index 71a32b39..787372d2 100644 --- a/tools/serialization/flatbuffers/sequence/sequence_diagram.fbs +++ b/tools/serialization/flatbuffers/sequence/sequence_diagram.fbs @@ -13,6 +13,11 @@ namespace sequence_metamodel; +table SourceLocation { + file: string; + line: uint32; +} + /// The kind of condition / group block in a sequence diagram. enum ConditionType : byte { Opt = 0, @@ -75,6 +80,8 @@ union Event { table SequenceNode { /// The event at this node event: Event; + /// Source location for this node + source_location: SourceLocation (required); /// Child nodes (nested calls, branches, …) branches_node: [SequenceNode]; } @@ -85,10 +92,6 @@ table SequenceDiagram { name: string; /// Top-level sequence nodes root_interactions: [SequenceNode]; - /// Source files parsed - source_files: [string]; - /// Parser/writer version - version: string; } root_type SequenceDiagram; diff --git a/tools/serialization/flatbuffers/sequence/sequence_serializer.rs b/tools/serialization/flatbuffers/sequence/sequence_serializer.rs index a336b49e..fcdb63f0 100644 --- a/tools/serialization/flatbuffers/sequence/sequence_serializer.rs +++ b/tools/serialization/flatbuffers/sequence/sequence_serializer.rs @@ -18,7 +18,7 @@ use sequence_logic::{ConditionType, Event, SequenceNode, SequenceTree}; pub struct SequenceSerializer; impl SequenceSerializer { - pub fn serialize(diagram: &SequenceTree, source_file: &str) -> Vec { + pub fn serialize(diagram: &SequenceTree, _diagram_name: &str) -> Vec { let mut builder = FlatBufferBuilder::new(); let name_offset = diagram.name.as_deref().map(|n| builder.create_string(n)); @@ -30,16 +30,11 @@ impl SequenceSerializer { .collect(); let nodes_offset = builder.create_vector(&node_offsets); - let source_offsets = [builder.create_string(source_file)]; - let source_files_offset = builder.create_vector(&source_offsets); - let root = fb::SequenceDiagram::create( &mut builder, &fb::SequenceDiagramArgs { name: name_offset, root_interactions: Some(nodes_offset), - source_files: Some(source_files_offset), - version: None, }, ); @@ -58,6 +53,14 @@ impl SequenceSerializer { .map(|child| Self::serialize_node(builder, child)) .collect(); let branches_offset = builder.create_vector(&branch_offsets); + let location_file_offset = builder.create_string(node.source_location.file.as_ref()); + let source_location = fb::SourceLocation::create( + builder, + &fb::SourceLocationArgs { + file: Some(location_file_offset), + line: node.source_location.line, + }, + ); // Serialize the event union. let (event_type, event_offset) = Self::serialize_event(builder, &node.event); @@ -67,6 +70,7 @@ impl SequenceSerializer { &fb::SequenceNodeArgs { event_type, event: Some(event_offset), + source_location: Some(source_location), branches_node: Some(branches_offset), }, ) diff --git a/validation/core/src/models/sequence_diagram_models.rs b/validation/core/src/models/sequence_diagram_models.rs index 9e2321ca..6d92d093 100644 --- a/validation/core/src/models/sequence_diagram_models.rs +++ b/validation/core/src/models/sequence_diagram_models.rs @@ -29,6 +29,8 @@ pub struct ObservedSequenceCall { pub caller: String, pub callee: String, pub method: String, + pub source_file: String, + pub source_line: u32, } impl SequenceDiagramInputs { @@ -80,12 +82,17 @@ fn collect_sequence_data( Event::Interaction(interaction) => { validate_required_endpoints( result, - "sequence function-call connection", - interaction.caller.as_str(), - interaction.callee.as_str(), - interaction.method.as_str(), - "Sequence function", - "Provide both caller and callee for each sequence function-call connection", + RequiredEndpointsCheck { + connection_kind: "sequence function-call connection", + caller: interaction.caller.as_str(), + callee: interaction.callee.as_str(), + label_value: interaction.method.as_str(), + label_name: "Sequence function", + action: + "Provide both caller and callee for each sequence function-call connection", + source_file: node.source_location.file.as_ref(), + source_line: node.source_location.line, + }, ); if !interaction.caller.is_empty() { @@ -99,17 +106,23 @@ fn collect_sequence_data( caller: interaction.caller.clone(), callee: interaction.callee.clone(), method: interaction.method.clone(), + source_file: node.source_location.file.to_string(), + source_line: node.source_location.line, }); } Event::Return(ret) => { validate_required_endpoints( result, - "sequence return connection", - ret.caller.as_str(), - ret.callee.as_str(), - ret.return_content.as_str(), - "Return content", - "Provide both caller and callee for each sequence return connection", + RequiredEndpointsCheck { + connection_kind: "sequence return connection", + caller: ret.caller.as_str(), + callee: ret.callee.as_str(), + label_value: ret.return_content.as_str(), + label_name: "Return content", + action: "Provide both caller and callee for each sequence return connection", + source_file: node.source_location.file.as_ref(), + source_line: node.source_location.line, + }, ); if !ret.caller.is_empty() { @@ -127,15 +140,29 @@ fn collect_sequence_data( } } -fn validate_required_endpoints( - result: &mut ValidationResult, - connection_kind: &str, - caller: &str, - callee: &str, - label_value: &str, - label_name: &str, - action: &str, -) { +struct RequiredEndpointsCheck<'a> { + connection_kind: &'a str, + caller: &'a str, + callee: &'a str, + label_value: &'a str, + label_name: &'a str, + action: &'a str, + source_file: &'a str, + source_line: u32, +} + +fn validate_required_endpoints(result: &mut ValidationResult, check: RequiredEndpointsCheck<'_>) { + let RequiredEndpointsCheck { + connection_kind, + caller, + callee, + label_value, + label_name, + action, + source_file, + source_line, + } = check; + if !caller.is_empty() && !callee.is_empty() { return; } @@ -153,7 +180,11 @@ fn validate_required_endpoints( Caller unit : \"{caller}\"\n\ Callee unit : \"{callee}\"\n\ {label_name:<18}: \"{label_value}\"\n\ + Source file : \"{source_file}\"\n\ + Source line : \"{source_line}\"\n\ Action : {action}", + source_file = source_file, + source_line = source_line, )); } @@ -174,6 +205,7 @@ mod tests { callee: callee.to_string(), method: method.to_string(), }), + source_location: sequence_logic::SourceLocation::new("test.puml", 0), branches_node, } } @@ -185,6 +217,7 @@ mod tests { callee: callee.to_string(), return_content: String::new(), }), + source_location: sequence_logic::SourceLocation::new("test.puml", 0), branches_node: Vec::new(), } } diff --git a/validation/core/src/readers/sequence_diagram_reader.rs b/validation/core/src/readers/sequence_diagram_reader.rs index 082519b0..68400ae8 100644 --- a/validation/core/src/readers/sequence_diagram_reader.rs +++ b/validation/core/src/readers/sequence_diagram_reader.rs @@ -21,7 +21,7 @@ use sequence_logic::{ }; use crate::models::SequenceDiagramInputs; -use crate::readers::Reader; +use crate::readers::{to_source_location, Reader}; pub struct SequenceDiagramReader; @@ -127,6 +127,10 @@ fn read_node(node: fb_sequence::SequenceNode<'_>, node_path: &str) -> Result { pub(in crate::validators) caller_unit: &'a str, pub(in crate::validators) callee_unit: &'a str, pub(in crate::validators) method: &'a str, + pub(in crate::validators) source_file: &'a str, + pub(in crate::validators) source_line: u32, pub(in crate::validators) caller_interfaces: BTreeSet, pub(in crate::validators) callee_interfaces: BTreeSet, } @@ -120,6 +122,8 @@ pub(in crate::validators) fn build_observed_call_contexts<'a>( method: call.method.as_str(), caller_interfaces, callee_interfaces, + source_file: call.source_file.as_str(), + source_line: call.source_line, } }) .collect() diff --git a/validation/core/src/validators/test/fixtures.rs b/validation/core/src/validators/test/fixtures.rs index 12b87dd3..9369e30a 100644 --- a/validation/core/src/validators/test/fixtures.rs +++ b/validation/core/src/validators/test/fixtures.rs @@ -117,6 +117,7 @@ pub(super) fn sequence_calls(calls: &[(&str, &str, &str)]) -> SequenceDiagramInp callee: (*callee).to_string(), method: (*method).to_string(), }), + source_location: SourceLocation::new("test.puml", 0), branches_node: Vec::new(), }) .collect(), From 37bf216caca60a91d6af6dd0bae37e9ccde137f2 Mon Sep 17 00:00:00 2001 From: Xian Gu Date: Wed, 8 Jul 2026 14:37:31 +0800 Subject: [PATCH 4/4] fix sequence tests --- .../comprehensive_sequence_test.json | 954 +++++++++++++++--- .../sequence_diagram/simple_sequence.json | 204 +++- .../sequence_diagram/src/sequence_resolver.rs | 10 +- .../src/sequence_diagram/test/logic.json | 100 ++ .../src/models/component_diagram_models.rs | 7 +- .../src/models/sequence_diagram_models.rs | 5 +- .../validators/bazel_component_validator.rs | 4 +- .../test/component_sequence_validator_test.rs | 3 +- .../core/src/validators/test/fixtures.rs | 10 +- .../sequence_internal_api_validator_test.rs | 3 +- 10 files changed, 1089 insertions(+), 211 deletions(-) diff --git a/plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.json b/plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.json index 3501e1ae..500c806e 100644 --- a/plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.json +++ b/plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.json @@ -5,7 +5,11 @@ "identifier": { "Id": "Actor1" }, - "stereotype": null + "stereotype": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 27 + } } }, { @@ -14,7 +18,11 @@ "identifier": { "Id": "Actor2" }, - "stereotype": null + "stereotype": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 28 + } } }, { @@ -26,7 +34,11 @@ "id": "runtime" } }, - "stereotype": null + "stereotype": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 31 + } } }, { @@ -38,7 +50,11 @@ "id": "Builder" } }, - "stereotype": null + "stereotype": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 32 + } } }, { @@ -50,7 +66,11 @@ "id": "messaging" } }, - "stereotype": null + "stereotype": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 33 + } } }, { @@ -62,7 +82,11 @@ "id": "TaskHandler" } }, - "stereotype": null + "stereotype": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 36 + } } }, { @@ -74,7 +98,11 @@ "id": "ProxyHandle" } }, - "stereotype": null + "stereotype": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 39 + } } }, { @@ -86,13 +114,21 @@ "id": "ServiceHost" } }, - "stereotype": null + "stereotype": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 40 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Arrow Types" + "text": "Arrow Types", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 46 + } } }, { @@ -113,7 +149,11 @@ "right": "Actor2" } }, - "description": "Standard message" + "description": "Standard message", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 48 + } } }, { @@ -134,7 +174,11 @@ "right": "Actor1" } }, - "description": "Return message" + "description": "Return message", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 51 + } } }, { @@ -155,7 +199,11 @@ "right": "Actor1" } }, - "description": "Reverse message" + "description": "Reverse message", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 54 + } } }, { @@ -176,7 +224,11 @@ "right": "Actor1" } }, - "description": "Reverse return" + "description": "Reverse return", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 55 + } } }, { @@ -197,7 +249,11 @@ "right": "Actor1" } }, - "description": "Incoming request" + "description": "Incoming request", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 56 + } } }, { @@ -218,19 +274,31 @@ "right": "" } }, - "description": "Outgoing response" + "description": "Outgoing response", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 57 + } } }, { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 61 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Activation Patterns" + "text": "Activation Patterns", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 67 + } } }, { @@ -256,7 +324,11 @@ "right": "Actor2" } }, - "description": "Activate target" + "description": "Activate target", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 70 + } } }, { @@ -282,7 +354,11 @@ "right": "Builder" } }, - "description": "Nested call" + "description": "Nested call", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 74 + } } }, { @@ -308,7 +384,11 @@ "right": "Actor2" } }, - "description": null + "description": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 76 + } } }, { @@ -334,7 +414,11 @@ "right": "Actor1" } }, - "description": null + "description": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 79 + } } }, { @@ -350,13 +434,21 @@ { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 82 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Lifecycle Events" + "text": "Lifecycle Events", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 88 + } } }, { @@ -382,7 +474,11 @@ "right": "TaskHandler" } }, - "description": "create" + "description": "create", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 90 + } } }, { @@ -403,19 +499,31 @@ "right": "Actor1" } }, - "description": null + "description": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 91 + } } }, { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 92 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Self Messages" + "text": "Self Messages", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 98 + } } }, { @@ -436,7 +544,11 @@ "right": "Actor1" } }, - "description": "Internal operation" + "description": "Internal operation", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 99 + } } }, { @@ -457,13 +569,21 @@ "right": "Actor1" } }, - "description": "runtime::wait_for_shutdown()" + "description": "runtime::wait_for_shutdown()", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 100 + } } }, { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 101 + } } }, { @@ -484,13 +604,21 @@ "right": "Actor2" } }, - "description": "Message with inline note" + "description": "Message with inline note", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 128 + } } }, { "GroupCmd": { "group_type": "Alt", - "text": "configuration is cached" + "text": "configuration is cached", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 135 + } } }, { @@ -511,13 +639,21 @@ "right": "Actor2" } }, - "description": "Cached result" + "description": "Cached result", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 136 + } } }, { "GroupCmd": { "group_type": "Else", - "text": "configuration needs to be fetched" + "text": "configuration needs to be fetched", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 137 + } } }, { @@ -538,7 +674,11 @@ "right": "messaging" } }, - "description": "Fetch from service" + "description": "Fetch from service", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 138 + } } }, { @@ -559,19 +699,31 @@ "right": "Actor1" } }, - "description": "Result" + "description": "Result", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 139 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 140 + } } }, { "GroupCmd": { "group_type": "Alt", - "text": "system is in restricted mode and the access token is invalid\\n or it does not match the request" + "text": "system is in restricted mode and the access token is invalid\\n or it does not match the request", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 142 + } } }, { @@ -592,13 +744,21 @@ "right": "Actor1" } }, - "description": "Error response" + "description": "Error response", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 143 + } } }, { "GroupCmd": { "group_type": "Else", - "text": "access token is valid" + "text": "access token is valid", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 144 + } } }, { @@ -619,19 +779,31 @@ "right": "Actor1" } }, - "description": "Success response" + "description": "Success response", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 145 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 146 + } } }, { "GroupCmd": { "group_type": "Loop", - "text": "For each item" + "text": "For each item", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 152 + } } }, { @@ -652,19 +824,31 @@ "right": "Actor2" } }, - "description": "Process item" + "description": "Process item", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 153 + } } }, { "GroupCmd": { "group_type": "End", - "text": "loop" + "text": "loop", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 154 + } } }, { "GroupCmd": { "group_type": "Loop", - "text": "(item_list) [Call FetchValue for each item]" + "text": "(item_list) [Call FetchValue for each item]", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 156 + } } }, { @@ -685,25 +869,41 @@ "right": "Builder" } }, - "description": "FetchValue(item)" + "description": "FetchValue(item)", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 157 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 158 + } } }, { "GroupCmd": { "group_type": "Loop", - "text": "0..2 {0..3000ms}" + "text": "0..2 {0..3000ms}", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 160 + } } }, { "GroupCmd": { "group_type": "Alt", - "text": "timeout not reached" + "text": "timeout not reached", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 161 + } } }, { @@ -724,25 +924,41 @@ "right": "Actor2" } }, - "description": "Retry" + "description": "Retry", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 162 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 163 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 164 + } } }, { "GroupCmd": { "group_type": "Loop", - "text": "For Segment in Segments" + "text": "For Segment in Segments", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 166 + } } }, { @@ -763,37 +979,61 @@ "right": "Actor2" } }, - "description": "Process segment" + "description": "Process segment", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 167 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 168 + } } }, { "GroupCmd": { "group_type": "Loop", - "text": "Until success" + "text": "Until success", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 174 + } } }, { "GroupCmd": { "group_type": "Alt", - "text": "condition met" + "text": "condition met", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 175 + } } }, { "GroupCmd": { "group_type": "Break", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 176 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 177 + } } }, { @@ -814,19 +1054,31 @@ "right": "Actor2" } }, - "description": "Continue processing" + "description": "Continue processing", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 178 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 179 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Complex Messages" + "text": "Complex Messages", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 185 + } } }, { @@ -847,7 +1099,11 @@ "right": "Builder" } }, - "description": "Run(config_collection, callback, stop_token, error_reporter)" + "description": "Run(config_collection, callback, stop_token, error_reporter)", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 187 + } } }, { @@ -868,7 +1124,11 @@ "right": "TaskHandler" } }, - "description": "StartResponse::ValidationResult::kAccepted (0x00)" + "description": "StartResponse::ValidationResult::kAccepted (0x00)", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 190 + } } }, { @@ -889,7 +1149,11 @@ "right": "ProxyHandle" } }, - "description": "std::unique_ptr>" + "description": "std::unique_ptr>", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 193 + } } }, { @@ -910,19 +1174,31 @@ "right": "Actor2" } }, - "description": "PerformQualification() [[https:" + "description": "PerformQualification() [[https:", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 196 + } } }, { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 197 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Complex Flow with All Elements" + "text": "Complex Flow with All Elements", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 203 + } } }, { @@ -948,7 +1224,11 @@ "right": "messaging" } }, - "description": "Initialize(context)" + "description": "Initialize(context)", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 205 + } } }, { @@ -979,7 +1259,11 @@ "right": "Builder" } }, - "description": "create" + "description": "create", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 209 + } } }, { @@ -1000,7 +1284,11 @@ "right": "messaging" } }, - "description": null + "description": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 210 + } } }, { @@ -1021,7 +1309,11 @@ "right": "Builder" } }, - "description": "Configure(params)" + "description": "Configure(params)", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 212 + } } }, { @@ -1047,13 +1339,21 @@ "right": "Builder" } }, - "description": "ValidateConfiguration()" + "description": "ValidateConfiguration()", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 215 + } } }, { "GroupCmd": { "group_type": "Alt", - "text": "configuration is valid" + "text": "configuration is valid", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 217 + } } }, { @@ -1074,13 +1374,21 @@ "right": "messaging" } }, - "description": "Success" + "description": "Success", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 218 + } } }, { "GroupCmd": { "group_type": "Loop", - "text": "For each service" + "text": "For each service", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 220 + } } }, { @@ -1101,7 +1409,11 @@ "right": "ServiceHost" } }, - "description": "StartService()" + "description": "StartService()", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 221 + } } }, { @@ -1122,19 +1434,31 @@ "right": "messaging" } }, - "description": null + "description": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 222 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 223 + } } }, { "GroupCmd": { "group_type": "Else", - "text": "configuration invalid" + "text": "configuration invalid", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 224 + } } }, { @@ -1155,13 +1479,21 @@ "right": "messaging" } }, - "description": "Error" + "description": "Error", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 225 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 227 + } } }, { @@ -1187,7 +1519,11 @@ "right": "runtime" } }, - "description": "ExitCodeOk" + "description": "ExitCodeOk", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 230 + } } }, { @@ -1203,13 +1539,21 @@ { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 233 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Construction stage" + "text": "Construction stage", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 239 + } } }, { @@ -1235,19 +1579,31 @@ "right": "Actor1" } }, - "description": "create" + "description": "create", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 241 + } } }, { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 242 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Initialization stage" + "text": "Initialization stage", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 244 + } } }, { @@ -1268,13 +1624,21 @@ "right": "Actor1" } }, - "description": "Initialize()" + "description": "Initialize()", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 245 + } } }, { "GroupCmd": { "group_type": "Alt", - "text": "system ready" + "text": "system ready", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 247 + } } }, { @@ -1295,25 +1659,41 @@ "right": "Actor2" } }, - "description": "StartServices()" + "description": "StartServices()", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 248 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 249 + } } }, { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 250 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Run stage" + "text": "Run stage", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 252 + } } }, { @@ -1334,13 +1714,21 @@ "right": "Actor1" } }, - "description": "Run(stop_token)" + "description": "Run(stop_token)", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 253 + } } }, { "GroupCmd": { "group_type": "Loop", - "text": "Until stop requested" + "text": "Until stop requested", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 255 + } } }, { @@ -1361,25 +1749,41 @@ "right": "Actor1" } }, - "description": "ProcessEvents()" + "description": "ProcessEvents()", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 256 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 257 + } } }, { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 258 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Edge Cases" + "text": "Edge Cases", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 264 + } } }, { @@ -1400,7 +1804,11 @@ "right": "Actor2" } }, - "description": null + "description": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 266 + } } }, { @@ -1421,19 +1829,31 @@ "right": "Actor1" } }, - "description": null + "description": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 267 + } } }, { "GroupCmd": { "group_type": "Alt", - "text": "condition" + "text": "condition", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 270 + } } }, { "GroupCmd": { "group_type": "Else", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 271 + } } }, { @@ -1454,13 +1874,21 @@ "right": "Actor2" } }, - "description": "Default action" + "description": "Default action", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 272 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 273 + } } }, { @@ -1486,7 +1914,11 @@ "right": "Actor2" } }, - "description": "Call1" + "description": "Call1", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 277 + } } }, { @@ -1512,7 +1944,11 @@ "right": "Builder" } }, - "description": "Call2" + "description": "Call2", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 279 + } } }, { @@ -1538,7 +1974,11 @@ "right": "TaskHandler" } }, - "description": "Call3" + "description": "Call3", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 281 + } } }, { @@ -1564,7 +2004,11 @@ "right": "Builder" } }, - "description": null + "description": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 283 + } } }, { @@ -1590,7 +2034,11 @@ "right": "Actor2" } }, - "description": null + "description": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 285 + } } }, { @@ -1616,7 +2064,11 @@ "right": "Actor1" } }, - "description": null + "description": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 287 + } } }, { @@ -1632,13 +2084,21 @@ { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 290 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Extended Patterns: Preprocessor Functions" + "text": "Extended Patterns: Preprocessor Functions", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 296 + } } }, { @@ -1659,7 +2119,11 @@ "right": "Actor2" } }, - "description": "$redtext(\"Error message\")" + "description": "$redtext(\"Error message\")", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 306 + } } }, { @@ -1680,19 +2144,31 @@ "right": "Actor1" } }, - "description": "$greentext(\"Success message\")" + "description": "$greentext(\"Success message\")", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 307 + } } }, { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 308 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Extended Patterns: Participants with Colors" + "text": "Extended Patterns: Participants with Colors", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 310 + } } }, { @@ -1701,7 +2177,11 @@ "identifier": { "Id": "ColoredActor1" }, - "stereotype": null + "stereotype": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 312 + } } }, { @@ -1710,7 +2190,11 @@ "identifier": { "Id": "ColoredActor2" }, - "stereotype": null + "stereotype": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 313 + } } }, { @@ -1719,7 +2203,11 @@ "identifier": { "Id": "ColoredActor3" }, - "stereotype": null + "stereotype": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 314 + } } }, { @@ -1740,7 +2228,11 @@ "right": "ColoredActor2" } }, - "description": "Message" + "description": "Message", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 316 + } } }, { @@ -1761,19 +2253,31 @@ "right": "ColoredActor3" } }, - "description": "Another message" + "description": "Another message", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 317 + } } }, { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 318 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Extended Patterns: Boxes with Colors" + "text": "Extended Patterns: Boxes with Colors", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 320 + } } }, { @@ -1782,7 +2286,11 @@ "identifier": { "Id": "BoxedActor1" }, - "stereotype": null + "stereotype": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 322 + } } }, { @@ -1791,7 +2299,11 @@ "identifier": { "Id": "BoxedActor2" }, - "stereotype": null + "stereotype": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 323 + } } }, { @@ -1812,19 +2324,31 @@ "right": "BoxedActor2" } }, - "description": "Message inside box" + "description": "Message inside box", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 326 + } } }, { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 327 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Extended Patterns: Lost and Found Messages" + "text": "Extended Patterns: Lost and Found Messages", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 329 + } } }, { @@ -1845,7 +2369,11 @@ "right": "Actor1" } }, - "description": "Incoming request" + "description": "Incoming request", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 331 + } } }, { @@ -1866,7 +2394,11 @@ "right": "Actor2" } }, - "description": "Another incoming" + "description": "Another incoming", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 332 + } } }, { @@ -1887,7 +2419,11 @@ "right": "Builder" } }, - "description": "Third variant" + "description": "Third variant", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 333 + } } }, { @@ -1908,7 +2444,11 @@ "right": "o]" } }, - "description": "Outgoing response" + "description": "Outgoing response", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 336 + } } }, { @@ -1929,7 +2469,11 @@ "right": "]" } }, - "description": "Another outgoing" + "description": "Another outgoing", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 337 + } } }, { @@ -1950,7 +2494,11 @@ "right": "x]" } }, - "description": "Third variant" + "description": "Third variant", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 338 + } } }, { @@ -1971,7 +2519,11 @@ "right": "Actor1" } }, - "description": "Right bracket on left" + "description": "Right bracket on left", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 341 + } } }, { @@ -1992,19 +2544,31 @@ "right": "o[" } }, - "description": "Left bracket on right" + "description": "Left bracket on right", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 342 + } } }, { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 343 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Extended Patterns: Activation Markers" + "text": "Extended Patterns: Activation Markers", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 345 + } } }, { @@ -2026,7 +2590,11 @@ } }, "activation_marker": "++", - "description": "Activate with message" + "description": "Activate with message", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 347 + } } }, { @@ -2048,7 +2616,11 @@ } }, "activation_marker": "++", - "description": "Nested activation" + "description": "Nested activation", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 348 + } } }, { @@ -2070,7 +2642,11 @@ } }, "activation_marker": "--", - "description": "Deactivate with response" + "description": "Deactivate with response", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 349 + } } }, { @@ -2092,7 +2668,11 @@ } }, "activation_marker": "--", - "description": "Deactivate outer" + "description": "Deactivate outer", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 350 + } } }, { @@ -2114,7 +2694,11 @@ } }, "activation_marker": "**", - "description": "Create and activate" + "description": "Create and activate", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 353 + } } }, { @@ -2136,31 +2720,51 @@ } }, "activation_marker": "!!", - "description": "Destroy marker" + "description": "Destroy marker", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 356 + } } }, { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 357 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Extended Patterns: Ref Blocks" + "text": "Extended Patterns: Ref Blocks", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 359 + } } }, { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 368 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Extended Patterns: Dividers with URLs" + "text": "Extended Patterns: Dividers with URLs", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 370 + } } }, { @@ -2181,7 +2785,11 @@ "right": "Actor2" } }, - "description": "Initialize" + "description": "Initialize", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 372 + } } }, { @@ -2202,7 +2810,11 @@ "right": "Builder" } }, - "description": "Process" + "description": "Process", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 375 + } } }, { @@ -2223,19 +2835,31 @@ "right": "Actor1" } }, - "description": "Verify" + "description": "Verify", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 378 + } } }, { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 379 + } } }, { "GroupCmd": { "group_type": "Group", - "text": "Extended Patterns: Standalone Ellipsis" + "text": "Extended Patterns: Standalone Ellipsis", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 381 + } } }, { @@ -2256,7 +2880,11 @@ "right": "Actor2" } }, - "description": "Start process" + "description": "Start process", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 382 + } } }, { @@ -2277,13 +2905,21 @@ "right": "Actor1" } }, - "description": "Complete" + "description": "Complete", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 384 + } } }, { "GroupCmd": { "group_type": "End", - "text": "group" + "text": "group", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/comprehensive_sequence_test.puml", + "line": 385 + } } } ] diff --git a/plantuml/parser/integration_test/sequence_diagram/simple_sequence.json b/plantuml/parser/integration_test/sequence_diagram/simple_sequence.json index 947ecaf5..44c71c33 100644 --- a/plantuml/parser/integration_test/sequence_diagram/simple_sequence.json +++ b/plantuml/parser/integration_test/sequence_diagram/simple_sequence.json @@ -8,7 +8,11 @@ "id": "ComponentA" } }, - "stereotype": "component" + "stereotype": "component", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 16 + } } }, { @@ -20,7 +24,11 @@ "id": "ComponentB" } }, - "stereotype": "component" + "stereotype": "component", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 17 + } } }, { @@ -32,7 +40,11 @@ "id": "ComponentC" } }, - "stereotype": "component" + "stereotype": "component", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 18 + } } }, { @@ -53,13 +65,21 @@ "right": "ComponentB" } }, - "description": "callMethod1()" + "description": "callMethod1()", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 20 + } } }, { "GroupCmd": { "group_type": "Alt", - "text": "condition1" + "text": "condition1", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 21 + } } }, { @@ -80,13 +100,21 @@ "right": "ComponentA" } }, - "description": "Return Result" + "description": "Return Result", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 22 + } } }, { "GroupCmd": { "group_type": "Else", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 23 + } } }, { @@ -107,7 +135,11 @@ "right": "ComponentC" } }, - "description": "method2(1)" + "description": "method2(1)", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 24 + } } }, { @@ -128,13 +160,21 @@ "right": "ComponentB" } }, - "description": "Return Result" + "description": "Return Result", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 25 + } } }, { "GroupCmd": { "group_type": "Loop", - "text": "for i = 0; i < 3; ++i" + "text": "for i = 0; i < 3; ++i", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 27 + } } }, { @@ -155,7 +195,11 @@ "right": "ComponentC" } }, - "description": "method2(i)" + "description": "method2(i)", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 28 + } } }, { @@ -176,13 +220,21 @@ "right": "ComponentB" } }, - "description": "Return Result" + "description": "Return Result", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 29 + } } }, { "GroupCmd": { "group_type": "Alt", - "text": "innerConditionA" + "text": "innerConditionA", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 30 + } } }, { @@ -203,7 +255,11 @@ "right": "ComponentC" } }, - "description": "method2(extra)" + "description": "method2(extra)", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 31 + } } }, { @@ -224,25 +280,41 @@ "right": "ComponentB" } }, - "description": "Return Result" + "description": "Return Result", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 32 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 33 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 34 + } } }, { "GroupCmd": { "group_type": "Loop", - "text": "while count > 0" + "text": "while count > 0", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 36 + } } }, { @@ -263,7 +335,11 @@ "right": "ComponentC" } }, - "description": "method2(count)" + "description": "method2(count)", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 37 + } } }, { @@ -284,13 +360,21 @@ "right": "ComponentB" } }, - "description": "Return Result" + "description": "Return Result", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 38 + } } }, { "GroupCmd": { "group_type": "Alt", - "text": "innerConditionB" + "text": "innerConditionB", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 39 + } } }, { @@ -311,7 +395,11 @@ "right": "ComponentC" } }, - "description": "method2(fallback)" + "description": "method2(fallback)", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 40 + } } }, { @@ -332,13 +420,21 @@ "right": "ComponentB" } }, - "description": "Return Result" + "description": "Return Result", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 41 + } } }, { "GroupCmd": { "group_type": "Else", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 42 + } } }, { @@ -359,7 +455,11 @@ "right": "ComponentC" } }, - "description": "method2(default)" + "description": "method2(default)", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 43 + } } }, { @@ -380,25 +480,41 @@ "right": "ComponentB" } }, - "description": "Return Result" + "description": "Return Result", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 44 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 45 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 46 + } } }, { "GroupCmd": { "group_type": "Alt", - "text": "condition2" + "text": "condition2", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 48 + } } }, { @@ -419,7 +535,11 @@ "right": "ComponentC" } }, - "description": "method2(result)" + "description": "method2(result)", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 49 + } } }, { @@ -440,13 +560,21 @@ "right": "ComponentB" } }, - "description": "Return Result" + "description": "Return Result", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 50 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 51 + } } }, { @@ -467,13 +595,21 @@ "right": "ComponentA" } }, - "description": "Return Result" + "description": "Return Result", + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 53 + } } }, { "GroupCmd": { "group_type": "End", - "text": null + "text": null, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 54 + } } } ] diff --git a/plantuml/parser/puml_resolver/src/sequence_diagram/src/sequence_resolver.rs b/plantuml/parser/puml_resolver/src/sequence_diagram/src/sequence_resolver.rs index 7a61ccf8..f921c9ad 100644 --- a/plantuml/parser/puml_resolver/src/sequence_diagram/src/sequence_resolver.rs +++ b/plantuml/parser/puml_resolver/src/sequence_diagram/src/sequence_resolver.rs @@ -146,6 +146,10 @@ mod sequence_resolver_tests { } } + fn dummy_source_location() -> SourceLocation { + SourceLocation::new("test.puml", 0) + } + fn make_call(from: &str, to: &str, label: &str) -> Statement { Statement::Message(Message { content: MessageContent::WithTargets { @@ -155,7 +159,7 @@ mod sequence_resolver_tests { }, activation_marker: None, description: Some(label.to_string()), - source_location: SourceLocation::new("test.puml", 0), + source_location: dummy_source_location(), }) } @@ -168,7 +172,7 @@ mod sequence_resolver_tests { }, activation_marker: None, description: Some(label.to_string()), - source_location: SourceLocation::new("test.puml", 0), + source_location: dummy_source_location(), }) } @@ -237,7 +241,7 @@ mod sequence_resolver_tests { participant_type: ParticipantType::Participant, identifier: ParticipantIdentifier::Id(name.to_string()), stereotype: None, - source_location: SourceLocation::new("test.puml", 0), + source_location: dummy_source_location(), }) } diff --git a/plantuml/parser/puml_resolver/src/sequence_diagram/test/logic.json b/plantuml/parser/puml_resolver/src/sequence_diagram/test/logic.json index 60b88f18..5289ec01 100644 --- a/plantuml/parser/puml_resolver/src/sequence_diagram/test/logic.json +++ b/plantuml/parser/puml_resolver/src/sequence_diagram/test/logic.json @@ -7,6 +7,10 @@ "method": "callMethod1()" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 20 + }, "branches_node": [ { "event": { @@ -15,6 +19,10 @@ "condition_value": "condition1" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 21 + }, "branches_node": [ { "event": { @@ -24,6 +32,10 @@ "return_content": "Return Result" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 22 + }, "branches_node": [] } ] @@ -35,6 +47,10 @@ "condition_value": "" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 23 + }, "branches_node": [ { "event": { @@ -44,6 +60,10 @@ "method": "method2(1)" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 24 + }, "branches_node": [ { "event": { @@ -53,6 +73,10 @@ "return_content": "Return Result" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 25 + }, "branches_node": [] } ] @@ -64,6 +88,10 @@ "condition_value": "for i = 0; i < 3; ++i" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 27 + }, "branches_node": [ { "event": { @@ -73,6 +101,10 @@ "method": "method2(i)" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 28 + }, "branches_node": [ { "event": { @@ -82,6 +114,10 @@ "return_content": "Return Result" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 29 + }, "branches_node": [] } ] @@ -93,6 +129,10 @@ "condition_value": "innerConditionA" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 30 + }, "branches_node": [ { "event": { @@ -102,6 +142,10 @@ "method": "method2(extra)" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 31 + }, "branches_node": [ { "event": { @@ -111,6 +155,10 @@ "return_content": "Return Result" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 32 + }, "branches_node": [] } ] @@ -126,6 +174,10 @@ "condition_value": "while count > 0" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 36 + }, "branches_node": [ { "event": { @@ -135,6 +187,10 @@ "method": "method2(count)" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 37 + }, "branches_node": [ { "event": { @@ -144,6 +200,10 @@ "return_content": "Return Result" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 38 + }, "branches_node": [] } ] @@ -155,6 +215,10 @@ "condition_value": "innerConditionB" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 39 + }, "branches_node": [ { "event": { @@ -164,6 +228,10 @@ "method": "method2(fallback)" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 40 + }, "branches_node": [ { "event": { @@ -173,6 +241,10 @@ "return_content": "Return Result" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 41 + }, "branches_node": [] } ] @@ -186,6 +258,10 @@ "condition_value": "" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 42 + }, "branches_node": [ { "event": { @@ -195,6 +271,10 @@ "method": "method2(default)" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 43 + }, "branches_node": [ { "event": { @@ -204,6 +284,10 @@ "return_content": "Return Result" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 44 + }, "branches_node": [] } ] @@ -219,6 +303,10 @@ "condition_value": "condition2" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 48 + }, "branches_node": [ { "event": { @@ -228,6 +316,10 @@ "method": "method2(result)" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 49 + }, "branches_node": [ { "event": { @@ -237,6 +329,10 @@ "return_content": "Return Result" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 50 + }, "branches_node": [] } ] @@ -251,6 +347,10 @@ "return_content": "Return Result" } }, + "source_location": { + "file": "plantuml/parser/integration_test/sequence_diagram/simple_sequence.puml", + "line": 53 + }, "branches_node": [] } ] diff --git a/validation/core/src/models/component_diagram_models.rs b/validation/core/src/models/component_diagram_models.rs index ea8fa73f..0881273d 100644 --- a/validation/core/src/models/component_diagram_models.rs +++ b/validation/core/src/models/component_diagram_models.rs @@ -15,8 +15,6 @@ use std::collections::BTreeMap; use super::EntityKey; use crate::ValidationResult; -#[cfg(test)] -use component_diagram::SourceLocation; pub use component_diagram::{ ComponentRelationType, ComponentType, EndpointRole, LogicComponent, LogicRelation, }; @@ -186,6 +184,7 @@ impl ComponentDiagramArchitecture { #[cfg(test)] mod tests { use super::*; + use crate::validators::fixtures::dummy_source_location; fn relation(target: &str) -> LogicRelation { LogicRelation { @@ -193,7 +192,7 @@ mod tests { annotation: None, relation_type: ComponentRelationType::Association, source_role: EndpointRole::None, - source_location: SourceLocation::new("", 0), + source_location: dummy_source_location(), } } @@ -213,7 +212,7 @@ mod tests { element_type, stereotype: stereotype.map(str::to_string), relations, - source_location: SourceLocation::new("", 0), + source_location: dummy_source_location(), } } diff --git a/validation/core/src/models/sequence_diagram_models.rs b/validation/core/src/models/sequence_diagram_models.rs index 6d92d093..8fe77315 100644 --- a/validation/core/src/models/sequence_diagram_models.rs +++ b/validation/core/src/models/sequence_diagram_models.rs @@ -191,6 +191,7 @@ fn validate_required_endpoints(result: &mut ValidationResult, check: RequiredEnd #[cfg(test)] mod tests { use super::*; + use crate::validators::fixtures::dummy_source_location; use sequence_logic::{Interaction, Return}; fn interaction( @@ -205,7 +206,7 @@ mod tests { callee: callee.to_string(), method: method.to_string(), }), - source_location: sequence_logic::SourceLocation::new("test.puml", 0), + source_location: dummy_source_location(), branches_node, } } @@ -217,7 +218,7 @@ mod tests { callee: callee.to_string(), return_content: String::new(), }), - source_location: sequence_logic::SourceLocation::new("test.puml", 0), + source_location: dummy_source_location(), branches_node: Vec::new(), } } diff --git a/validation/core/src/validators/bazel_component_validator.rs b/validation/core/src/validators/bazel_component_validator.rs index 0466c32f..07951b01 100644 --- a/validation/core/src/validators/bazel_component_validator.rs +++ b/validation/core/src/validators/bazel_component_validator.rs @@ -229,7 +229,7 @@ mod tests { use crate::models::{ BazelInput, BazelInputEntry, ComponentDiagramInputs, ComponentType, LogicComponent, }; - use component_diagram::SourceLocation; + use crate::validators::fixtures::dummy_source_location; use std::collections::BTreeMap; fn make_arch(entries: Vec<(&str, Vec<&str>, Vec<&str>)>) -> BazelInput { @@ -266,7 +266,7 @@ mod tests { element_type, stereotype: stereotype.map(|s| s.to_string()), relations: Vec::new(), - source_location: SourceLocation::new("", 0), + source_location: dummy_source_location(), } } diff --git a/validation/core/src/validators/test/component_sequence_validator_test.rs b/validation/core/src/validators/test/component_sequence_validator_test.rs index b4088e40..f0dda80e 100644 --- a/validation/core/src/validators/test/component_sequence_validator_test.rs +++ b/validation/core/src/validators/test/component_sequence_validator_test.rs @@ -14,7 +14,6 @@ use super::super::fixtures::*; use super::*; use crate::models::{ComponentDiagramInputs, ComponentType, LogicComponent, SequenceDiagramInputs}; use crate::ValidationResult; -use component_diagram::SourceLocation; fn validate( component_diagrams: ComponentDiagramInputs, @@ -73,7 +72,7 @@ fn units_without_alias_are_ignored() { element_type: ComponentType::Component, stereotype: Some("unit".to_string()), relations: Vec::new(), - source_location: SourceLocation::new("", 0), + source_location: dummy_source_location(), }], }; let sequence_diagrams = sequence_diagrams(&[]); diff --git a/validation/core/src/validators/test/fixtures.rs b/validation/core/src/validators/test/fixtures.rs index 9369e30a..fc1c8843 100644 --- a/validation/core/src/validators/test/fixtures.rs +++ b/validation/core/src/validators/test/fixtures.rs @@ -20,6 +20,10 @@ use class_diagram::{ClassDiagram, EntityType, Method, SimpleEntity, Visibility}; use component_diagram::SourceLocation; use sequence_logic::{Event, Interaction, SequenceNode, SequenceTree}; +pub(crate) fn dummy_source_location() -> SourceLocation { + SourceLocation::new("", 0) +} + pub(super) fn relation_with_role(target: &str, source_role: EndpointRole) -> LogicRelation { relation_with_type_and_role(target, ComponentRelationType::InterfaceBinding, source_role) } @@ -34,7 +38,7 @@ pub(super) fn relation_with_type_and_role( annotation: None, relation_type, source_role, - source_location: SourceLocation::new("", 0), + source_location: dummy_source_location(), } } @@ -63,7 +67,7 @@ pub(super) fn unit_with_interface_roles( element_type: ComponentType::Component, stereotype: Some("unit".to_string()), relations, - source_location: SourceLocation::new("", 0), + source_location: dummy_source_location(), } } @@ -80,7 +84,7 @@ pub(super) fn interface_with_id(id: &str, alias: &str) -> LogicComponent { element_type: ComponentType::Interface, stereotype: None, relations: Vec::new(), - source_location: SourceLocation::new("", 0), + source_location: dummy_source_location(), } } diff --git a/validation/core/src/validators/test/sequence_internal_api_validator_test.rs b/validation/core/src/validators/test/sequence_internal_api_validator_test.rs index d6ed366e..89409689 100644 --- a/validation/core/src/validators/test/sequence_internal_api_validator_test.rs +++ b/validation/core/src/validators/test/sequence_internal_api_validator_test.rs @@ -18,7 +18,6 @@ use crate::models::{ SequenceDiagramInputs, }; use crate::ValidationResult; -use component_diagram::SourceLocation; fn validate( sequence_diagrams: SequenceDiagramInputs, @@ -55,7 +54,7 @@ fn unit_with_non_binding_interface(alias: &str, interface_id: &str) -> LogicComp ComponentRelationType::Dependency, EndpointRole::None, )], - source_location: SourceLocation::new("", 0), + source_location: dummy_source_location(), } }