Fix meta schema validation
This commit is contained in:
parent
11f666a793
commit
5b6061c7e6
@ -460,10 +460,10 @@ public:
|
|||||||
|
|
||||||
// Array
|
// Array
|
||||||
if (const ValueType* v = GetMember(value, "items")) {
|
if (const ValueType* v = GetMember(value, "items")) {
|
||||||
if (v->IsObject()) // List validation
|
|
||||||
document->CreateSchema(&itemsList_, p, *v);
|
|
||||||
else if (v->IsArray()) { // Tuple validation
|
|
||||||
PointerType q = p.Append("items");
|
PointerType q = p.Append("items");
|
||||||
|
if (v->IsObject()) // List validation
|
||||||
|
document->CreateSchema(&itemsList_, q, *v);
|
||||||
|
else if (v->IsArray()) { // Tuple validation
|
||||||
itemsTuple_ = static_cast<const Schema**>(allocator_->Malloc(sizeof(const Schema*) * v->Size()));
|
itemsTuple_ = static_cast<const Schema**>(allocator_->Malloc(sizeof(const Schema*) * v->Size()));
|
||||||
SizeType index = 0;
|
SizeType index = 0;
|
||||||
for (ConstValueIterator itr = v->Begin(); itr != v->End(); ++itr, index++)
|
for (ConstValueIterator itr = v->Begin(); itr != v->End(); ++itr, index++)
|
||||||
@ -1126,7 +1126,6 @@ private:
|
|||||||
SValue minimum_;
|
SValue minimum_;
|
||||||
SValue maximum_;
|
SValue maximum_;
|
||||||
SValue multipleOf_;
|
SValue multipleOf_;
|
||||||
bool hasMultipleOf_;
|
|
||||||
bool exclusiveMinimum_;
|
bool exclusiveMinimum_;
|
||||||
bool exclusiveMaximum_;
|
bool exclusiveMaximum_;
|
||||||
};
|
};
|
||||||
|
@ -659,7 +659,7 @@ TEST(SchemaValidator, Array_ItemsList) {
|
|||||||
SchemaDocument s(sd);
|
SchemaDocument s(sd);
|
||||||
|
|
||||||
VALIDATE(s, "[1, 2, 3, 4, 5]", true);
|
VALIDATE(s, "[1, 2, 3, 4, 5]", true);
|
||||||
INVALIDATE(s, "[1, 2, \"3\", 4, 5]", "", "type", "/2");
|
INVALIDATE(s, "[1, 2, \"3\", 4, 5]", "/items", "type", "/2");
|
||||||
VALIDATE(s, "[]", true);
|
VALIDATE(s, "[]", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -776,8 +776,8 @@ TEST(SchemaValidator, ObjectInArray) {
|
|||||||
SchemaDocument s(sd);
|
SchemaDocument s(sd);
|
||||||
|
|
||||||
VALIDATE(s, "[\"a\"]", true);
|
VALIDATE(s, "[\"a\"]", true);
|
||||||
INVALIDATE(s, "[1]", "", "type", "/0");
|
INVALIDATE(s, "[1]", "/items", "type", "/0");
|
||||||
INVALIDATE(s, "[{}]", "", "type", "/0");
|
INVALIDATE(s, "[{}]", "/items", "type", "/0");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(SchemaValidator, MultiTypeInObject) {
|
TEST(SchemaValidator, MultiTypeInObject) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user