32 const package &p, nlohmann::json &parent)
const
37 if (
model().should_include(relationship_t::kDependency)) {
39 nlohmann::json rel = r;
41 auto destination_package =
model().get(r.destination());
43 if (!destination_package)
46 rel[
"source"] = std::to_string(p.
id().
value());
47 parent[
"relationships"].push_back(std::move(rel));
52 for (
const auto &subpackage : p) {
54 dynamic_cast<const package &
>(*subpackage), parent);
64 const auto &uns =
config().using_namespace();
65 if (!uns.starts_with({p.full_name(false)})) {
67 j[
"id"] = std::to_string(p.
id().
value());
69 j[
"type"] = to_string(
config().package_type());
70 j[
"display_name"] = display_name_adapter(p).with_packages().name();
71 switch (
config().package_type()) {
84 if (!p.
file().empty())
85 j[
"source_location"] =
87 if (
const auto &comment = p.
comment(); comment)
88 j[
"comment"] = comment.value();
90 for (
const auto &subpackage : p) {
91 auto &pkg =
dynamic_cast<package &
>(*subpackage);
95 parent[
"elements"].push_back(std::move(j));
98 for (
const auto &subpackage : p) {
99 auto &pkg =
dynamic_cast<package &
>(*subpackage);
107 if (
config().using_namespace)
108 parent[
"using_namespace"] =
config().using_namespace().to_string();
109 if (
config().using_module)
110 parent[
"using_module"] =
config().using_module();
112 parent[
"name"] =
model().name();
113 parent[
"diagram_type"] =
"package";
114 parent[
"package_type"] = to_string(
config().package_type());
115 parent[
"elements"] = std::vector<nlohmann::json>{};
116 parent[
"relationships"] = std::vector<nlohmann::json>{};
118 for (
const auto &p :
model()) {
119 auto &pkg =
dynamic_cast<package &
>(*p);
124 for (
const auto &p :
model()) {