|
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"
|
@@ -370,6 +374,15 @@ static void verify_swagger_content(
|
370 | 374 | }
|
371 | 375 | }
|
372 | 376 |
|
| 377 | +static std::string to_string(const JsonDocument &json_doc) { |
| 378 | + rapidjson::StringBuffer buffer; |
| 379 | + rapidjson::PrettyWriter writer(buffer); |
| 380 | + |
| 381 | + json_doc.Accept(writer); |
| 382 | + |
| 383 | + return buffer.GetString(); |
| 384 | +} |
| 385 | + |
373 | 386 | void RestApiComponentTest::fetch_and_validate_schema_and_resource(
|
374 | 387 | const RestApiTestParams &test_params, ProcessWrapper &http_server,
|
375 | 388 | const std::string &http_hostname) {
|
@@ -468,8 +481,8 @@ void RestApiComponentTest::fetch_and_validate_schema_and_resource(
|
468 | 481 | // HEAD does not return a body
|
469 | 482 | if (method != HttpMethod::Head) {
|
470 | 483 | for (const auto &kv : test_params.value_checks) {
|
471 |
| - ASSERT_NO_FATAL_FAILURE( |
472 |
| - validate_value(json_doc, kv.first, kv.second)); |
| 484 | + ASSERT_NO_FATAL_FAILURE(validate_value(json_doc, kv.first, kv.second)) |
| 485 | + << to_string(json_doc); |
473 | 486 | }
|
474 | 487 | }
|
475 | 488 | }
|
|
0 commit comments