@@ -877,22 +877,31 @@ class numeric : public schema
877
877
{
878
878
T value = instance; // conversion of json to value_type
879
879
880
+ std::ostringstream oss;
881
+
880
882
if (multipleOf_.first && value != 0 ) // zero is multiple of everything
881
883
if (violates_multiple_of (value))
882
- e. error (ptr, instance, " instance is not a multiple of " + std::to_string (multipleOf_.second ) );
884
+ oss << " instance is not a multiple of " << json (multipleOf_.second );
883
885
884
886
if (maximum_.first ) {
885
887
if (exclusiveMaximum_ && value >= maximum_.second )
886
- e. error (ptr, instance, " instance exceeds or equals maximum of " + std::to_string (maximum_.second ) );
888
+ oss << " instance exceeds or equals maximum of " << json (maximum_.second );
887
889
else if (value > maximum_.second )
888
- e. error (ptr, instance, " instance exceeds maximum of " + std::to_string (maximum_.second ) );
890
+ oss << " instance exceeds maximum of " << json (maximum_.second );
889
891
}
890
892
891
893
if (minimum_.first ) {
892
894
if (exclusiveMinimum_ && value <= minimum_.second )
893
- e. error (ptr, instance, " instance is below or equals minimum of " + std::to_string (minimum_.second ) );
895
+ oss << " instance is below or equals minimum of " << json (minimum_.second );
894
896
else if (value < minimum_.second )
895
- e.error (ptr, instance, " instance is below minimum of " + std::to_string (minimum_.second ));
897
+ oss << " instance is below minimum of " << json (minimum_.second );
898
+ }
899
+
900
+ oss.seekp (0 , std::ios::end);
901
+ auto size = oss.tellp ();
902
+ if (size != 0 ) {
903
+ oss.seekp (0 , std::ios::beg);
904
+ e.error (ptr, instance, oss.str ());
896
905
}
897
906
}
898
907
0 commit comments