Add formatting script for c++ (#203)

This commit is contained in:
Aaron Po
2026-04-19 15:46:30 -04:00
committed by GitHub
parent 898cc8971b
commit 1f008f1237
11 changed files with 74 additions and 47 deletions

View File

@@ -122,8 +122,8 @@ static bool ReadRequiredTrimmedStringField(const boost::json::object& obj,
const boost::json::value* field = obj.if_contains(key);
if (field == nullptr || !field->is_string()) {
if (error_out != nullptr) {
*error_out = "JSON field '" + std::string(key) +
"' is missing or not a string";
*error_out =
"JSON field '" + std::string(key) + "' is missing or not a string";
}
return false;
}
@@ -192,8 +192,7 @@ std::optional<std::string> ValidateBreweryJson(const std::string& raw,
return validation_error;
}
if (!ReadRequiredTrimmedStringField(obj, "name_local",
brewery_out.name_local,
if (!ReadRequiredTrimmedStringField(obj, "name_local", brewery_out.name_local,
&validation_error)) {
return validation_error;
}