diff --git a/include/rapidjson/schema.h b/include/rapidjson/schema.h index 348dd379..dd57edbc 100644 --- a/include/rapidjson/schema.h +++ b/include/rapidjson/schema.h @@ -783,8 +783,10 @@ public: if (patternProperties_) { context.patternPropertiesSchemaCount = 0; 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.valueSchema = typeless_; + } } SizeType index; diff --git a/test/unittest/schematest.cpp b/test/unittest/schematest.cpp index 30b32605..e79fec28 100644 --- a/test/unittest/schematest.cpp +++ b/test/unittest/schematest.cpp @@ -1322,6 +1322,13 @@ TEST(SchemaValidator, Issue728_AllOfRef) { 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__ RAPIDJSON_DIAG_POP #endif