| 321 | // for nested pipeline stages. |
| 322 | template <typename Writer> |
| 323 | void WriteInspectionResultJson(Writer& writer, |
| 324 | const ConversionInspectionResult& result) { |
| 325 | writer.StartObject(); |
| 326 | writer.Key("input"); |
| 327 | writer.String(result.input.c_str(), result.input.size()); |
| 328 | writer.Key("segments"); |
| 329 | writer.StartArray(); |
| 330 | for (const auto& seg : result.segments) { |
| 331 | writer.String(seg.c_str(), seg.size()); |
| 332 | } |
| 333 | writer.EndArray(); |
| 334 | writer.Key("stages"); |
| 335 | writer.StartArray(); |
| 336 | for (const auto& stage : result.stages) { |
| 337 | writer.StartObject(); |
| 338 | writer.Key("index"); |
| 339 | writer.Uint64(stage.index); |
| 340 | writer.Key("segments"); |
| 341 | writer.StartArray(); |
| 342 | for (const auto& seg : stage.segments) { |
| 343 | writer.String(seg.c_str(), seg.size()); |
| 344 | } |
| 345 | writer.EndArray(); |
| 346 | writer.EndObject(); |
| 347 | } |
| 348 | writer.EndArray(); |
| 349 | writer.Key("pipelineStages"); |
| 350 | writer.StartArray(); |
| 351 | for (const auto& ps : result.pipelineStages) { |
| 352 | WriteInspectionResultJson(writer, ps); |
| 353 | } |
| 354 | writer.EndArray(); |
| 355 | writer.Key("output"); |
| 356 | writer.String(result.output.c_str(), result.output.size()); |
| 357 | writer.EndObject(); |
| 358 | } |
| 359 | |
| 360 | // Serializes the full inspection result as a JSON object. Used with |
| 361 | // --inspect mode. Handles both single-stage and pipeline converters. |
no test coverage detected