libcruft-util/json/schema/introspection.hpp

36 lines
1.2 KiB
C++

#pragma once
#include "../../introspection.hpp"
#include "fwd.hpp"
namespace util {
#define SCHEMA_INTROSPECTION(K) \
namespace detail { \
struct type_name_cruft_json_schema_constraint_##K { \
static constexpr const char value[] = #K; \
}; \
} \
\
template <> \
struct type_name<::util::json::schema::constraint::K> : \
public detail::type_name_cruft_json_schema_constraint_##K \
{ };
template <template <typename> class OperatorT>
struct type_name<::util::json::schema::constraint::inequality<OperatorT>> {
static constexpr const char value[] = "inequality";
};
template <typename OperatorT>
struct type_name<::util::json::schema::constraint::length<OperatorT>> {
static constexpr const char value[] = "length";
};
MAP0(SCHEMA_INTROSPECTION, type, combine, properties)
#undef SCHEMA_INTROSPECTION
}