mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
use default value in fetchers::PublicKey
json deserialization
This commit is contained in:
parent
c73172e986
commit
943a877a6a
1 changed files with 7 additions and 3 deletions
|
@ -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 a new issue