mirror of
https://github.com/NixOS/nix
synced 2025-06-28 05:21:16 +02:00
Complete the toJSON
instance for Setting<T>
Don't let it just contain the value, but also the other fields of the setting (description, aliases, etc..)
This commit is contained in:
parent
3b57181f8e
commit
3c525d1590
3 changed files with 19 additions and 29 deletions
|
@ -206,7 +206,9 @@ protected:
|
|||
|
||||
virtual std::string to_string() const = 0;
|
||||
|
||||
virtual nlohmann::json toJSON();
|
||||
nlohmann::json toJSON();
|
||||
|
||||
virtual std::map<std::string, nlohmann::json> toJSONObject();
|
||||
|
||||
virtual void convertToArg(Args & args, const std::string & category);
|
||||
|
||||
|
@ -251,7 +253,12 @@ public:
|
|||
|
||||
void convertToArg(Args & args, const std::string & category) override;
|
||||
|
||||
nlohmann::json toJSON() override;
|
||||
std::map<std::string, nlohmann::json> toJSONObject() override
|
||||
{
|
||||
auto obj = AbstractSetting::toJSONObject();
|
||||
obj.emplace("value", value);
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue