# responseSchemaForType

**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#L385)

The response schema an endpoint declares, resolved against the repo's own models.

LANGUAGE-NEUTRAL BY DESIGN. The TypeScript path gets this from ts-morph, but nothing here
needs a type checker: any parser that records the response type's NAME — FastAPI's
`response_model=`, a .NET `ActionResult<T>`, a Java `ResponseEntity<T>` — gets the same
treatment. Keeping this in the spec builder rather than the ts-morph resolver is the
difference between one language being well documented and all of them being.

`responseType` may carry a list marker (`Project[]`, `List[Project]`, `List<Project>`);
`responseIsList` is honoured when a parser states it outright.

## Signature

```ts
function responseSchemaForType(responseType: string | undefined, knownModels: Set<string>, responseIsList: boolean, options: {
    /** Generic declarations from the same parse, by name. */
    generics?: Map<string, ModelSource>;
    /** Called with each instantiated envelope so the caller can add it to components. */
    register?: (name: string, schema: Record<string, unknown>) => void;
  }): Record<string, unknown> | undefined
```

## Parameters

| Name | Type |
|---|---|
| `responseType` | `string | undefined` |
| `knownModels` | `Set<string>` |
| `responseIsList` | `boolean` |
| `options` | `{
    /** Generic declarations from the same parse, by name. */
    generics?: Map<string, ModelSource>;
    /** Called with each instantiated envelope so the caller can add it to components. */
    register?: (name: string, schema: Record<string, unknown>) => void;
  }` |

**Returns:** `Record<string, unknown> | undefined`
