# instantiateGeneric

**Kind:** Function

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

Substitute a generic model's parameters and register the result as a component.

`PaginatedItems<CatalogItem>` is a real response shape, and eShop returns it from most of its
endpoints — but the declaration's own fields are typed against `TEntity`, which matches no
model, so publishing the envelope as-is documents `Data: string[]`. Wrong, and worse than
silence.

Substituting gives a genuine schema, and it is emitted as a NAMED component
(`PaginatedItemsOfCatalogItem`, the spelling Swashbuckle and NSwag both use) rather than
inlined, so thirty endpoints returning the same envelope share one definition instead of
carrying thirty copies.

## Signature

```ts
function instantiateGeneric(model: ModelSource, args: string[], register: (name: string, schema: Record<string, unknown>) => void, knownModels: Set<string>): string | undefined
```

## Parameters

| Name | Type |
|---|---|
| `model` | `ModelSource` |
| `args` | `string[]` |
| `register` | `(name: string, schema: Record<string, unknown>) => void` |
| `knownModels` | `Set<string>` |

**Returns:** `string | undefined`
