Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make schema error quotation and punctuation more consistent #498

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading