You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: warp.md
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -473,12 +473,14 @@ type = "transform"
473
473
spec_path = "path/to/jolt_spec.json"
474
474
apply = "both"# "left", "right", or "both" (default)
475
475
fail_on_error = true# true (default) or false
476
+
debug = false# true or false (default) - enables detailed logging of transform input/output
476
477
```
477
478
478
479
**Field Descriptions:**
479
480
-`spec_path`: Path to the JOLT specification file (JSON format). Relative paths are resolved from the config directory.
480
481
-`apply`: When to apply the transform - "left" (request to backend), "right" (response from backend), or "both" (default)
481
482
-`fail_on_error`: Whether to fail the request on transformation errors (true) or log and continue (false)
483
+
-`debug`: When true, logs the transform input and output at DEBUG level before and after transformation. Useful for debugging transform specs. Default false. Requires `RUST_LOG` to include `debug` or `trace` level for these logs to appear.
482
484
483
485
### JOLT Specification Example
484
486
@@ -550,6 +552,29 @@ Example transformation from patient data to FHIR-like structure:
550
552
}
551
553
```
552
554
555
+
### Debugging Transforms
556
+
557
+
Enable the `debug` option in your transform middleware configuration to log the complete input and output of the JOLT transformation. This is useful when developing or troubleshooting transform specs:
558
+
559
+
```toml
560
+
[middleware.debug_transform]
561
+
type = "transform"
562
+
[middleware.debug_transform.options]
563
+
spec_path = "path/to/jolt_spec.json"
564
+
debug = true# Enable detailed logging
565
+
```
566
+
567
+
When enabled, logs will show the transform input (including injected context) and the output from the JOLT engine. Run with appropriate log level:
568
+
```bash
569
+
RUST_LOG=harmony=debug cargo run -- --config config.toml
570
+
```
571
+
572
+
Logs will appear as:
573
+
```
574
+
JOLT transform input (request): {...}
575
+
JOLT transform output (request): {...}
576
+
```
577
+
553
578
### Pre-Transform Snapshot
554
579
555
580
The transform middleware automatically preserves the original `normalized_data` in the `normalized_snapshot` field before applying any transformations. This allows other middleware or debugging tools to access the pre-transform state.
0 commit comments