Truto Mapping Tester
Mission
Prove whether a unified API issue is caused by raw provider data, base mapping, environment override, query/body mapping, error mapping, or runtime behavior.
Inputs
Use any of: profile, account ID, model, resource, method, integration name, environment unified model ID, raw sample, query/body, mapping row ID, local mapping file, or failing unified output.
Resolve Context
truto accounts get "$ACCOUNT_ID" -p "$PROFILE" -o json --no-color
truto capabilities "$ACCOUNT_ID" --target account --type unified -p "$PROFILE" -o json --no-color
truto env-unified-models list --unified-model-name "$MODEL" -p "$PROFILE" -o json --no-color
truto unified-model-mappings list --integration-name "$INTEGRATION" --resource-name "$RESOURCE" --method-name "$METHOD" -p "$PROFILE" -o json --no-color
truto env-unified-model-mappings list --environment-unified-model-id "$ENV_UNIFIED_MODEL_ID" --integration-name "$INTEGRATION" --resource-name "$RESOURCE" --method-name "$METHOD" -p "$PROFILE" -o json --no-color
If ENV_UNIFIED_MODEL_ID is unknown, infer it from env-unified-models list for the current profile environment.
Build a Raw Sample
Capture raw provider data from the native proxy resource or a custom provider path:
truto proxy "$PROXY_RESOURCE" -m "$PROXY_METHOD" -a "$ACCOUNT_ID" --query-json "$QUERY_JSON" -p "$PROFILE" -o json --no-color > /tmp/truto-raw-sample.json
truto custom "$PATH" -m GET -a "$ACCOUNT_ID" --query-json "$QUERY_JSON" -p "$PROFILE" -o json --no-color > /tmp/truto-raw-sample.json
Use a small but representative payload. Avoid massive exports for mapping iteration.
Offline Response Mapping
Local mapping:
truto unified test-mapping --mapping-file "$MAPPING_FILE" --input /tmp/truto-raw-sample.json --query-json "$QUERY_JSON" -p "$PROFILE" -o json --no-color --show-mapping
Platform mapping:
truto unified test-mapping --model "$MODEL" --resource "$RESOURCE" --integration "$INTEGRATION" --method "$METHOD" --input /tmp/truto-raw-sample.json --query-json "$QUERY_JSON" -p "$PROFILE" -o json --no-color --show-mapping
With environment overrides:
truto unified test-mapping --model "$MODEL" --resource "$RESOURCE" --integration "$INTEGRATION" --method "$METHOD" --with-overrides "$ENV_UNIFIED_MODEL_ID" --input /tmp/truto-raw-sample.json --query-json "$QUERY_JSON" -p "$PROFILE" -o json --no-color --show-mapping
Runtime Compare
truto unified "$MODEL" "$RESOURCE" -m "$METHOD" -a "$ACCOUNT_ID" --query-json "$QUERY_JSON" -p "$PROFILE" -o json --no-color -v
If offline mapping succeeds but runtime fails, inspect query/body/error mappings, environment overrides, or platform logs.
JSONata Checks
- Output must match the unified schema and avoid extra fields.
- Do not map missing values to
nullunless the schema expects it. - Normalize singleton-vs-array cases.
- Convert dates to ISO strings for date/date-time fields.
- Use
$queryor$rawQueryonly when the mapping needs request context. test-mappingis offline and currently focuses onresponse_mapping; do not treat it as proof of provider call behavior.
Output
Return raw-sample source, mapping rows tested, offline result, runtime comparison, failing fields, root cause, and the smallest mapping or query/body change to test.