mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 06:42:28 +00:00
use default value in fetchers::PublicKey
json deserialization
This commit is contained in:
parent
c73172e986
commit
943a877a6a
@ -419,9 +419,13 @@ namespace nlohmann {
|
||||
using namespace nix;
|
||||
|
||||
fetchers::PublicKey adl_serializer<fetchers::PublicKey>::from_json(const json & json) {
|
||||
auto type = optionalValueAt(json, "type").value_or("ssh-ed25519");
|
||||
auto key = valueAt(json, "key");
|
||||
return fetchers::PublicKey { getString(type), getString(key) };
|
||||
fetchers::PublicKey res = { };
|
||||
if (auto type = optionalValueAt(json, "type"))
|
||||
res.type = getString(*type);
|
||||
|
||||
res.key = getString(valueAt(json, "key"));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void adl_serializer<fetchers::PublicKey>::to_json(json & json, fetchers::PublicKey p) {
|
||||
|
Loading…
Reference in New Issue
Block a user