@@ -440,7 +440,8 @@ class Schema {
440
440
minLength_(0 ),
441
441
maxLength_(~SizeType (0 )),
442
442
exclusiveMinimum_(false ),
443
- exclusiveMaximum_(false )
443
+ exclusiveMaximum_(false ),
444
+ defaultValueLength_(0 )
444
445
{
445
446
typedef typename SchemaDocumentType::ValueType ValueType;
446
447
typedef typename ValueType::ConstValueIterator ConstValueIterator;
@@ -635,6 +636,12 @@ class Schema {
635
636
if (const ValueType* v = GetMember (value, GetMultipleOfString ()))
636
637
if (v->IsNumber () && v->GetDouble () > 0.0 )
637
638
multipleOf_.CopyFrom (*v, *allocator_);
639
+
640
+ // Default
641
+ if (const ValueType* v = GetMember (value, GetDefaultValueString ()))
642
+ if (v->IsString ())
643
+ defaultValueLength_ = v->GetStringLength ();
644
+
638
645
}
639
646
640
647
~Schema () {
@@ -936,7 +943,8 @@ class Schema {
936
943
context.error_handler .StartMissingProperties ();
937
944
for (SizeType index = 0 ; index < propertyCount_; index++)
938
945
if (properties_[index].required && !context.propertyExist [index])
939
- context.error_handler .AddMissingProperty (properties_[index].name );
946
+ if (properties_[index].schema ->defaultValueLength_ == 0 )
947
+ context.error_handler .AddMissingProperty (properties_[index].name );
940
948
if (context.error_handler .EndMissingProperties ())
941
949
RAPIDJSON_INVALID_KEYWORD_RETURN (GetRequiredString ());
942
950
}
@@ -1046,6 +1054,7 @@ class Schema {
1046
1054
RAPIDJSON_STRING_(ExclusiveMinimum, ' e' , ' x' , ' c' , ' l' , ' u' , ' s' , ' i' , ' v' , ' e' , ' M' , ' i' , ' n' , ' i' , ' m' , ' u' , ' m' )
1047
1055
RAPIDJSON_STRING_(ExclusiveMaximum, ' e' , ' x' , ' c' , ' l' , ' u' , ' s' , ' i' , ' v' , ' e' , ' M' , ' a' , ' x' , ' i' , ' m' , ' u' , ' m' )
1048
1056
RAPIDJSON_STRING_(MultipleOf, ' m' , ' u' , ' l' , ' t' , ' i' , ' p' , ' l' , ' e' , ' O' , ' f' )
1057
+ RAPIDJSON_STRING_(DefaultValue, ' d' , ' e' , ' f' , ' a' , ' u' , ' l' , ' t' )
1049
1058
1050
1059
#undef RAPIDJSON_STRING_
1051
1060
@@ -1426,6 +1435,8 @@ class Schema {
1426
1435
SValue multipleOf_;
1427
1436
bool exclusiveMinimum_;
1428
1437
bool exclusiveMaximum_;
1438
+
1439
+ SizeType defaultValueLength_;
1429
1440
};
1430
1441
1431
1442
template <typename Stack, typename Ch>
0 commit comments