Merge pull request #977 from miloyip/issue825_patternProperties
Fix patternProperties & additionalProperties lead to ASSERT
This commit is contained in:
commit
b596f4e990
@ -783,8 +783,10 @@ public:
|
|||||||
if (patternProperties_) {
|
if (patternProperties_) {
|
||||||
context.patternPropertiesSchemaCount = 0;
|
context.patternPropertiesSchemaCount = 0;
|
||||||
for (SizeType i = 0; i < patternPropertyCount_; i++)
|
for (SizeType i = 0; i < patternPropertyCount_; i++)
|
||||||
if (patternProperties_[i].pattern && IsPatternMatch(patternProperties_[i].pattern, str, len))
|
if (patternProperties_[i].pattern && IsPatternMatch(patternProperties_[i].pattern, str, len)) {
|
||||||
context.patternPropertiesSchemas[context.patternPropertiesSchemaCount++] = patternProperties_[i].schema;
|
context.patternPropertiesSchemas[context.patternPropertiesSchemaCount++] = patternProperties_[i].schema;
|
||||||
|
context.valueSchema = typeless_;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SizeType index;
|
SizeType index;
|
||||||
|
@ -1322,6 +1322,13 @@ TEST(SchemaValidator, Issue728_AllOfRef) {
|
|||||||
VALIDATE(s, "{\"key1\": \"abc\", \"key2\": \"def\"}", true);
|
VALIDATE(s, "{\"key1\": \"abc\", \"key2\": \"def\"}", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(SchemaValidator, Issue825) {
|
||||||
|
Document sd;
|
||||||
|
sd.Parse("{\"type\": \"object\", \"additionalProperties\": false, \"patternProperties\": {\"^i\": { \"type\": \"string\" } } }");
|
||||||
|
SchemaDocument s(sd);
|
||||||
|
VALIDATE(s, "{ \"item\": \"hello\" }", true);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
RAPIDJSON_DIAG_POP
|
RAPIDJSON_DIAG_POP
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user