31 namespace fable::schema {
58 this->augment_schema(j);
62 bool validate(
const Conf& c, std::optional<SchemaError>& err)
const override {
68 assert(ptr_ !=
nullptr);
69 serialize_into(j, *ptr_);
73 assert(ptr_ !=
nullptr);
74 deserialize_into(c, *ptr_);
79 [[nodiscard]]
Json serialize(
const Type& x)
const {
83 void serialize_into(
Json& j,
const Type& x)
const {
84 ::nlohmann::adl_serializer<Type>::to_json(j, x);
87 template<
typename = std::enable_if<std::is_default_constructible_v<Type>>>
88 [[nodiscard]] Type deserialize(
const Conf& c)
const {
89 return c->get<Type>();
92 void deserialize_into(
const Conf& c, Type& x)
const {
Definition: interface.hpp:398
bool validate_type(const Conf &c, std::optional< SchemaError > &err) const
Definition: interface.hpp:459
std::string type_string() const override
Definition: interface.hpp:419
void reset_ptr() override
Definition: json.hpp:77
void from_conf(const Conf &c) override
Definition: json.hpp:72
void to_json(Json &j) const override
Definition: json.hpp:67
bool validate(const Conf &c, std::optional< SchemaError > &err) const override
Definition: json.hpp:62
Json json_schema() const override
Definition: json.hpp:54
virtual Json to_json() const
Definition: interface.hpp:254
nlohmann::json Json
Definition: fable_fwd.hpp:35
nlohmann::json::value_t JsonType
Definition: json.hpp:78