# ensurePorts

Canonical: https://docs.shumoku.dev/en/library/api/ensurePorts
Language: en

@shumoku/core · 0.4.0 · function

# ensurePorts

[Source](https://github.com/konoe-akitoshi/shumoku/blob/main/libs/@shumoku/core/src/models/migrate.ts#L87)

Walk the graph and ensure every link endpoint references an existing \`NodePort\`. Idempotent — graphs that already comply pass through unchanged (modulo deep-copy).

```
ensurePorts(graph: NetworkGraph): NetworkGraph
```

## Parameters

| Parameter | Type | Description | Default |
| --- | --- | --- | --- |
| `graph` | `NetworkGraph` | No additional description. | `—` |

## Returns

```
NetworkGraph
```

[`libs/@shumoku/core/src/models/migrate.ts:87`](https://github.com/konoe-akitoshi/shumoku/blob/main/libs/@shumoku/core/src/models/migrate.ts#L87)
