3#include <userver/chaotic/convert/to.hpp>
4#include <userver/chaotic/validators.hpp>
5#include <userver/formats/parse/to.hpp>
11template <
typename RawType,
typename... Validators>
12struct Primitive final {
16template <
typename Value,
typename RawType,
typename... Validators>
17RawType Parse(
const Value& value,
18 formats::
parse::
To<Primitive<RawType, Validators...>>) {
19 auto result = value.
template As<RawType>();
20 chaotic::Validate<Validators...>(result, value);
24template <
typename Value,
typename RawType,
typename... Validators>
25Value Serialize(
const Primitive<RawType, Validators...>& ps,
27 return typename Value::Builder{ps.value}.ExtractValue();