mirror of
https://github.com/tristanpenman/valijson.git
synced 2025-01-31 14:39:53 +01:00
Add placeholders for conditional constraint
This commit is contained in:
parent
0f9e8cacf8
commit
162f246e63
@ -116,6 +116,12 @@ private:
|
||||
/// Collection of sub-schemas, at least one of which must be satisfied
|
||||
Subschemas subschemas;
|
||||
};
|
||||
|
||||
class ConditionalConstraint: public BasicConstraint<ConditionalConstraint>
|
||||
{
|
||||
public:
|
||||
ConditionalConstraint() { }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Represents a 'dependencies' constraint.
|
||||
|
@ -7,6 +7,7 @@ namespace constraints {
|
||||
|
||||
class AllOfConstraint;
|
||||
class AnyOfConstraint;
|
||||
class ConditionalConstraint;
|
||||
class DependenciesConstraint;
|
||||
class EnumConstraint;
|
||||
class LinearItemsConstraint;
|
||||
@ -39,6 +40,7 @@ protected:
|
||||
// Shorten type names for derived classes outside of this namespace
|
||||
typedef constraints::AllOfConstraint AllOfConstraint;
|
||||
typedef constraints::AnyOfConstraint AnyOfConstraint;
|
||||
typedef constraints::ConditionalConstraint ConditionalConstraint;
|
||||
typedef constraints::DependenciesConstraint DependenciesConstraint;
|
||||
typedef constraints::EnumConstraint EnumConstraint;
|
||||
typedef constraints::LinearItemsConstraint LinearItemsConstraint;
|
||||
@ -66,6 +68,7 @@ public:
|
||||
|
||||
virtual bool visit(const AllOfConstraint &) = 0;
|
||||
virtual bool visit(const AnyOfConstraint &) = 0;
|
||||
virtual bool visit(const ConditionalConstraint &) = 0;
|
||||
virtual bool visit(const DependenciesConstraint &) = 0;
|
||||
virtual bool visit(const EnumConstraint &) = 0;
|
||||
virtual bool visit(const LinearItemsConstraint &) = 0;
|
||||
|
@ -1125,6 +1125,24 @@ private:
|
||||
return constraint;
|
||||
}
|
||||
|
||||
template<typename AdapterType>
|
||||
constraints::ConditionalConstraint makeConditionalConstraint(
|
||||
Schema &rootSchema,
|
||||
const AdapterType &rootNode,
|
||||
const AdapterType &ifNode,
|
||||
const AdapterType &thenNode,
|
||||
const AdapterType *elseNode,
|
||||
const opt::optional<std::string> currentScope,
|
||||
const std::string &nodePath,
|
||||
const typename FunctionPtrs<AdapterType>::FetchDoc fetchDoc,
|
||||
typename DocumentCache<AdapterType>::Type &docCache,
|
||||
SchemaCache &schemaCache
|
||||
) {
|
||||
constraints::ConditionalConstraint constraint;
|
||||
|
||||
return constraint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Make a new DependenciesConstraint object
|
||||
*
|
||||
|
@ -160,6 +160,11 @@ public:
|
||||
return numValidated > 0;
|
||||
}
|
||||
|
||||
virtual bool visit(const ConditionalConstraint &constraint)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Validate current node against a 'dependencies' constraint
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user