Skip to content

Commit fc14d6b

Browse files
committed
docs: minor
1 parent caa5b89 commit fc14d6b

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

warp.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,12 +473,14 @@ type = "transform"
473473
spec_path = "path/to/jolt_spec.json"
474474
apply = "both" # "left", "right", or "both" (default)
475475
fail_on_error = true # true (default) or false
476+
debug = false # true or false (default) - enables detailed logging of transform input/output
476477
```
477478

478479
**Field Descriptions:**
479480
- `spec_path`: Path to the JOLT specification file (JSON format). Relative paths are resolved from the config directory.
480481
- `apply`: When to apply the transform - "left" (request to backend), "right" (response from backend), or "both" (default)
481482
- `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.
482484

483485
### JOLT Specification Example
484486

@@ -550,6 +552,29 @@ Example transformation from patient data to FHIR-like structure:
550552
}
551553
```
552554

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+
553578
### Pre-Transform Snapshot
554579

555580
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

Comments
 (0)