|
@@ -12,6 +12,15 @@
|
|
|
#include <jvalidate/status.h>
|
|
#include <jvalidate/status.h>
|
|
|
|
|
|
|
|
namespace jvalidate::detail {
|
|
namespace jvalidate::detail {
|
|
|
|
|
+/**
|
|
|
|
|
+ * @brief An ArrayAdapter implmenetation for JSON "types" which do not support
|
|
|
|
|
+ * arrays. This is for example caused when attempting to apply json schema
|
|
|
|
|
+ * validation to non-json types representation, such as a some forms of
|
|
|
|
|
+ * PropertyTree implementations.
|
|
|
|
|
+ *
|
|
|
|
|
+ * This is specifically provided for making StringAdapter compatible with the
|
|
|
|
|
+ * Adapter concept.
|
|
|
|
|
+ */
|
|
|
template <typename CRTP> class UnsupportedArrayAdapter {
|
|
template <typename CRTP> class UnsupportedArrayAdapter {
|
|
|
public:
|
|
public:
|
|
|
size_t size() const { return 0; }
|
|
size_t size() const { return 0; }
|
|
@@ -20,6 +29,14 @@ public:
|
|
|
std::vector<CRTP>::const_iterator end() const { return {}; }
|
|
std::vector<CRTP>::const_iterator end() const { return {}; }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * @brief An ObjectAdapter implmenetation for JSON "types" which do not support
|
|
|
|
|
+ * objects. This is for example caused when attempting to apply json schema
|
|
|
|
|
+ * validation to non-json types representation.
|
|
|
|
|
+ *
|
|
|
|
|
+ * This is specifically provided for making StringAdapter compatible with the
|
|
|
|
|
+ * Adapter concept.
|
|
|
|
|
+ */
|
|
|
template <typename CRTP> class UnsupportedObjectAdapter {
|
|
template <typename CRTP> class UnsupportedObjectAdapter {
|
|
|
public:
|
|
public:
|
|
|
size_t size() const { return 0; }
|
|
size_t size() const { return 0; }
|
|
@@ -29,6 +46,13 @@ public:
|
|
|
std::map<std::string, CRTP>::const_iterator end() const { return {}; }
|
|
std::map<std::string, CRTP>::const_iterator end() const { return {}; }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * @brief An Adapter for strings, required for implmenting propertyNames
|
|
|
|
|
+ * constraints, which are applied to the keys of a JSON object.
|
|
|
|
|
+ *
|
|
|
|
|
+ * Unfortunately requires a large number of stub function implementations in
|
|
|
|
|
+ * order to satisfy adapter::Adapter AND Adapter concept.
|
|
|
|
|
+ */
|
|
|
class StringAdapter final : public adapter::Adapter {
|
|
class StringAdapter final : public adapter::Adapter {
|
|
|
public:
|
|
public:
|
|
|
using value_type = std::string_view;
|
|
using value_type = std::string_view;
|