|
27 | 27 | #include <thread>
|
28 | 28 |
|
29 | 29 | #include <gmock/gmock.h>
|
| 30 | + |
| 31 | +#define RAPIDJSON_HAVE_STDSTRING |
| 32 | + |
30 | 33 | #ifdef RAPIDJSON_NO_SIZETYPEDEFINE
|
31 | 34 | #include "my_rapidjson_size_t.h"
|
32 | 35 | #endif
|
33 |
| - |
34 | 36 | #include <rapidjson/document.h>
|
35 | 37 | #include <rapidjson/error/en.h>
|
| 38 | +#include <rapidjson/writer.h> |
| 39 | + |
36 | 40 | #include "mysqlrouter/rest_client.h"
|
37 | 41 |
|
38 | 42 | #include "rest_api_testutils.h"
|
@@ -369,6 +373,15 @@ static void verify_swagger_content(
|
369 | 373 | }
|
370 | 374 | }
|
371 | 375 |
|
| 376 | +static std::string to_string(const JsonDocument &json_doc) { |
| 377 | + rapidjson::StringBuffer buffer; |
| 378 | + rapidjson::PrettyWriter writer(buffer); |
| 379 | + |
| 380 | + json_doc.Accept(writer); |
| 381 | + |
| 382 | + return buffer.GetString(); |
| 383 | +} |
| 384 | + |
372 | 385 | void RestApiComponentTest::fetch_and_validate_schema_and_resource(
|
373 | 386 | const RestApiTestParams &test_params, ProcessWrapper &http_server,
|
374 | 387 | const std::string &http_hostname) {
|
@@ -467,8 +480,8 @@ void RestApiComponentTest::fetch_and_validate_schema_and_resource(
|
467 | 480 | // HEAD does not return a body
|
468 | 481 | if (method != HttpMethod::Head) {
|
469 | 482 | for (const auto &kv : test_params.value_checks) {
|
470 |
| - ASSERT_NO_FATAL_FAILURE( |
471 |
| - validate_value(json_doc, kv.first, kv.second)); |
| 483 | + ASSERT_NO_FATAL_FAILURE(validate_value(json_doc, kv.first, kv.second)) |
| 484 | + << to_string(json_doc); |
472 | 485 | }
|
473 | 486 | }
|
474 | 487 | }
|
|
0 commit comments