5#include <userver/compiler/demangle.hpp>
6#include <userver/formats/json/value.hpp>
10namespace storages::secdist {
12[[noreturn]]
void ThrowInvalidSecdistType(
const formats::json::Value& val, std::string_view type);
14std::string GetString(
const formats::json::Value& parent_val, std::string_view name);
16int GetInt(
const formats::json::Value& parent_val, std::string_view name,
int dflt);
19T GetValue(
const formats::json::Value& parent_val, std::string_view key,
const T& dflt) {
20 const auto& val = parent_val[key];
22 return val.
template As<T>(dflt);
23 }
catch (
const formats::json::TypeMismatchException&) {
24 ThrowInvalidSecdistType(val, compiler::GetTypeName<T>());
28void CheckIsObject(
const formats::json::Value& val, std::string_view name);
30void CheckIsArray(
const formats::json::Value& val, std::string_view name);