# Edit the workflow definition

Code view exposes the workflow's job definition as structured JSON. Use it for precise edits, reviewing a complex graph, or applying a repeatable change across several jobs. The canvas and code represent the same draft.

## Make a controlled edit

1. Save or otherwise preserve the current valid definition.
2. Switch from **Canvas** to **Code**.
3. Locate the job by its unique `id`.
4. Change only the intended fields.
5. Resolve JSON syntax errors and validation diagnostics.
6. Return to Canvas and confirm the resulting connections.
7. Save and test the workflow.

A typical job contains an `id`, a handler name, a `config` object, and a `depends_on` array. Named input bindings, conditions, batching, and composition metadata add more structure where supported.

## Preserve execution meaning

Changing `depends_on` changes data flow and ordering. Changing a handler while retaining the old handler's configuration can produce an invalid definition. Renaming a job requires checking every dependency and named binding that references it.

Do not remove app model bindings or release metadata merely because a stored fallback value appears sufficient. An app-inherited model is resolved from app parameters when the run starts; a fallback does not override that selection.

Use the step's reference for valid configuration keys. JSON permits many arbitrary objects, but the handler still enforces its own schema. Unknown handler names, cycles, missing jobs, invalid field types, and incompatible ports require correction.

## Distinguish definition code from processing code

The JSON definition configures the workflow. A Python exec job runs a restricted Python snippet against records; SQL query performs its configured database operation. Putting Python or SQL directly into unrelated JSON fields does not make the workflow execute it.

Use managed connections rather than embedding credentials in copied definitions. Review any imported snippets before running a workflow with destinations or model calls.

See [dependencies and ports](/docs/workflows/dependencies-and-ports), [custom processing](/docs/workflows/custom-processing), and [validation](/docs/workflows/validation).
