Refactored and unified JSON generators output (#223)
This commit is contained in:
@@ -42,7 +42,7 @@ void to_json(nlohmann::json &j, const element &c)
|
||||
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", detail::render_name(c.full_name(false))}};
|
||||
{"display_name", detail::render_name(c.full_name(true))}};
|
||||
|
||||
if (const auto &comment = c.comment(); comment)
|
||||
j["comment"] = comment.value();
|
||||
|
||||
@@ -35,13 +35,13 @@
|
||||
namespace clanguml::common::model {
|
||||
using nlohmann::json;
|
||||
|
||||
void to_json(nlohmann::json &j, const source_location &sl);
|
||||
void to_json(json &j, const source_location &sl);
|
||||
|
||||
void to_json(nlohmann::json &j, const element &c);
|
||||
void to_json(json &j, const element &c);
|
||||
|
||||
void to_json(nlohmann::json &j, const template_parameter &c);
|
||||
void to_json(json &j, const template_parameter &c);
|
||||
|
||||
void to_json(nlohmann::json &j, const relationship &c);
|
||||
void to_json(json &j, const relationship &c);
|
||||
} // namespace clanguml::common::model
|
||||
|
||||
namespace clanguml::common::generators::json {
|
||||
|
||||
@@ -123,8 +123,11 @@ public:
|
||||
*
|
||||
* @return Fully qualified elements name.
|
||||
*/
|
||||
std::string full_name(bool /*relative*/) const override
|
||||
std::string full_name(bool relative) const override
|
||||
{
|
||||
if (relative)
|
||||
return name();
|
||||
|
||||
return name_and_ns();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user