Skip to content

Commit

Permalink
Merge pull request #498 from mtmorgan/schema-error-quotation
Browse files Browse the repository at this point in the history
make schema error quotation and punctuation more consistent
  • Loading branch information
danielaparker authored Apr 3, 2024
2 parents 85fe3e0 + fdd6e66 commit 9368ac6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
16 changes: 8 additions & 8 deletions include/jsoncons_ext/jsonschema/common/format_validator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ namespace jsonschema {
eval_path,
schema_location,
instance_location,
"\"" + value + "\" is not a RFC 3339 date string"));
"'" + value + "' is not a RFC 3339 date string."));
}
}

Expand All @@ -918,7 +918,7 @@ namespace jsonschema {
eval_path,
schema_location,
instance_location,
"\"" + value + "\" is not a RFC 3339 time string"));
"'" + value + "' is not a RFC 3339 time string."));
}
}

Expand All @@ -934,7 +934,7 @@ namespace jsonschema {
eval_path,
schema_location,
instance_location,
"\"" + value + "\" is not a RFC 3339 date-time string"));
"'" + value + "' is not a RFC 3339 date-time string."));
}
}

Expand All @@ -950,7 +950,7 @@ namespace jsonschema {
eval_path,
schema_location,
instance_location,
"\"" + value + "\" is not a valid email address as defined by RFC 5322"));
"'" + value + "' is not a valid email address as defined by RFC 5322."));
}
}

Expand All @@ -966,7 +966,7 @@ namespace jsonschema {
eval_path,
schema_location,
instance_location,
"\"" + value + "\" is not a valid hostname as defined by RFC 3986 Appendix A"));
"'" + value + "' is not a valid hostname as defined by RFC 3986 Appendix A."));
}
}

Expand All @@ -982,7 +982,7 @@ namespace jsonschema {
eval_path,
schema_location,
instance_location,
"\"" + value + "\" is not a valid IPv4 address as defined by RFC 2673"));
"'" + value + "' is not a valid IPv4 address as defined by RFC 2673."));
}
}

Expand All @@ -998,7 +998,7 @@ namespace jsonschema {
eval_path,
schema_location,
instance_location,
"\"" + value + "\" is not a valid IPv6 address as defined by RFC 2373"));
"'" + value + "' is not a valid IPv6 address as defined by RFC 2373."));
}
}

Expand All @@ -1019,7 +1019,7 @@ namespace jsonschema {
eval_path,
schema_location,
instance_location,
"\"" + value + "\" is not a valid ECMAScript regular expression. " + e.what()));
"'" + value + "' is not a valid ECMAScript regular expression. " + e.what()));
}
#endif
}
Expand Down
16 changes: 8 additions & 8 deletions include/jsoncons_ext/jsonschema/common/keyword_validators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,11 @@ namespace jsonschema {
auto s = instance.template as<std::string>();
if (!std::regex_search(s, regex_))
{
std::string message("String \"");
std::string message("String '");
message.append(s);
message.append("\" does not match pattern \"");
message.append("' does not match pattern '");
message.append(pattern_string_);
message.append("\"");
message.append("'.");
reporter.error(validation_message(this->keyword_name(),
this_context.eval_path(),
this->schema_location(),
Expand Down Expand Up @@ -1303,7 +1303,7 @@ namespace jsonschema {
this_context.eval_path(),
this->schema_location(),
instance_location,
"Required property \"" + key + "\" not found"));
"Required property '" + key + "' not found."));
if(reporter.fail_early())
{
return;
Expand Down Expand Up @@ -1510,7 +1510,7 @@ namespace jsonschema {
this_context.eval_path(),
this->schema_location(),
instance_location,
instance.template as<std::string>() + " is not a valid enum value"));
"'" + instance.template as<std::string>() + "' is not a valid enum value."));
if (reporter.fail_early())
{
return;
Expand Down Expand Up @@ -1994,7 +1994,7 @@ namespace jsonschema {
prop_context.eval_path(),
this->schema_location(),
prop_location,
"Additional property '" + prop.key() + "' but the schema does not allow additional properties."));
"Additional property '" + prop.key() + "' not allowed by schema."));
break;
}
}
Expand Down Expand Up @@ -2033,7 +2033,7 @@ namespace jsonschema {
this_context.eval_path(),
additional_properties_->schema_location().string(),
instance_location,
"Additional property \"" + prop.key() + "\" found but was invalid."));
"Additional property '" + prop.key() + "' found but was invalid."));
if (reporter.fail_early())
{
return;
Expand Down Expand Up @@ -2396,7 +2396,7 @@ namespace jsonschema {
this_context.eval_path(),
this->schema_location(),
instance_location,
"Expected at least one array item to match \"contains\" schema",
"Expected at least one array item to match 'contains' schema.",
local_reporter.errors));
if (reporter.fail_early())
{
Expand Down
2 changes: 1 addition & 1 deletion test/jsonschema/src/validation_report_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ TEST_CASE("jsonschema additionalProperties output tests")
"evaluationPath": "/additionalProperties/direction",
"schemaLocation": "#",
"instanceLocation": "/direction",
"error": "Additional property 'direction' but the schema does not allow additional properties."
"error": "Additional property 'direction' not allowed by schema."
}
]
)");
Expand Down

0 comments on commit 9368ac6

Please sign in to comment.