# Publish a data mapping node

Map source object paths into an exact target contract with explicit conversions and preview validation.

Canonical URL: https://opennodeflow.dev/wiki/mapping/
JSON reference: https://opennodeflow.dev/wiki/mapping/index.json
Source snapshot: 2026-10-23

The Data mapping workbench creates an inspectable reusable node that converts one data contract into another. Use it when the problem is field selection, renaming, constants or explicit scalar conversion. It does not imply schema-equivalent types connect automatically or that arrays are iterated implicitly.

## Choose exact contracts

Open Data mapping workbench beside Add node or through Commands. Select the source and target types and their exact published versions. Read their schemas first: required fields, nullable values and additional-property rules determine what a valid result looks like.

Search source properties or enter dot-separated paths. For each target field, choose a source property or JSON constant, then its explicit conversion, optional missing-value fallback and required check. Treat a constant as JSON: the string `"false"` and boolean `false` are different values.

A useful synthetic example maps a source `reading.value` into target `watts` and a source `reading.id` into target `sampleId`. The target schema should require those fields only when the source contract and chosen fallback policy can actually produce them.

## Preview before publication

Supply a representative source sample. Preview first validates it against the source contract, applies the mapping, and validates the result against the selected target. Fix source errors separately from target errors so an invalid sample does not hide a bad mapping rule.

Missing properties may be omitted or replaced by a chosen fallback. Explicit null remains a value and is not silently treated as absence. If a target required field remains missing, adjust the source path, fallback or required schema deliberately rather than weakening the contract without understanding the data.

Number conversion rejects empty or nonnumeric values. Boolean conversion accepts booleans or the exact strings `true` and `false`; it does not apply general JavaScript truthiness. JSON conversion parses a string as JSON. A failed conversion should be diagnosed in preview before execution.

## Arrays and nested paths

Arrays can be copied as values. The workbench maps object paths and does not provide wildcard per-item iteration. Use a [collection](/wiki/collections/) when every item needs its own typed graph. Keep array result order and failure policy explicit there.

For provider remainders, missing/null variants or nominal typed fields, a compatible [codec](/wiki/codecs/) may be a better companion than forcing a broad dynamic mapping. Use the source and target contracts actually returned by the installed definitions.

## Publish and adopt

The UI requires a valid current preview before Publish mapping node. Publication creates ordinary inspectable code with exact socket pins and inserts the new asset into the current draft. Preview executes no workflow or provider code; publication does not update existing consumers.

Save and validate the parent after wiring it. Run a small synthetic example and inspect the mapped output. If either source or target type later changes, publish a deliberate new mapping version and upgrade selected callers through normal [versioning](/wiki/versioning/).

The preview demonstrates the tested sample and declared validation rules. It does not establish that every real provider response will contain the same optional paths; keep negative and missing-field cases in your test set.

---

## Documentation provenance

- `docs/AUTHORING-RELEASE-2026-10-21.md`
- `docs/TYPES-AND-VERSIONING.md`
- `docs/COLLECTIONS.md`

This page describes maintained source, not a live inventory or an authorization to perform actions.
