Added JSON test case stubs for all class diagram test cases
This commit is contained in:
@@ -21,6 +21,15 @@
|
||||
namespace clanguml::common::model {
|
||||
using nlohmann::json;
|
||||
|
||||
namespace detail {
|
||||
std::string render_name(std::string name)
|
||||
{
|
||||
util::replace_all(name, "##", "::");
|
||||
|
||||
return name;
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
void to_json(nlohmann::json &j, const source_location &sl)
|
||||
{
|
||||
j = json{{"file", sl.file_relative()}, {"line", sl.line()}};
|
||||
@@ -28,9 +37,10 @@ void to_json(nlohmann::json &j, const source_location &sl)
|
||||
|
||||
void to_json(nlohmann::json &j, const element &c)
|
||||
{
|
||||
j = json{{"id", std::to_string(c.id())}, {"name", c.name()},
|
||||
j = json{{"id", std::to_string(c.id())},
|
||||
{"name", detail::render_name(c.name())},
|
||||
{"namespace", c.get_namespace().to_string()}, {"type", c.type_name()},
|
||||
{"display_name", c.full_name(false)}};
|
||||
{"display_name", detail::render_name(c.full_name(false))}};
|
||||
|
||||
if (const auto &comment = c.comment(); comment)
|
||||
j["comment"] = comment.value();
|
||||
|
||||
Reference in New Issue
Block a user