# addCodeSamplesToSpec

**Kind:** Function

**Source:** [`atloria-monorepo/libs/parser-core/src/openapi/code-samples.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/parser-core/src/openapi/code-samples.ts#L278)

Attach `x-codeSamples` to every operation in the spec (mutates + returns it). Requires the
full spec so `$ref` request/response schemas resolve into example payloads.

## Signature

```ts
function addCodeSamplesToSpec(spec: any, targets: string[]): any
```

## Parameters

| Name | Type |
|---|---|
| `spec` | `any` |
| `targets` | `string[]` |

**Returns:** `any`
