# Swashbuckle.Core

**Kind:** Service

**Source:** `Pams/API/Pams.API/Pams.API.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

NuGet package dependency

`Swashbuckle.Core` is a NuGet dependency referenced by the Pams API project to generate Swagger metadata and expose API documentation endpoints. It runs with the API application and provides a machine-readable contract that client tools can read.

## Diagram

```mermaid
flowchart TD
    Startup[API startup] --> Swashbuckle[Swashbuckle.Core package]
    Swashbuckle --> SwaggerDoc[Swagger document endpoint]
    SwaggerDoc --> Client[API client or documentation tool]
```

## Usage

```ts
async function loadSwaggerDocument(
  apiBaseUrl: string,
  swaggerPath: string,
) {
  const response = await fetch(new URL(swaggerPath, apiBaseUrl));

  if (!response.ok) {
    throw new Error(`Unable to load Swagger document: ${response.status}`);
  }

  return response.json();
}

const document = await loadSwaggerDocument(
  "https://api.example.test",
  "/swagger/docs",
);

console.log(document);
```

## AI Coding Instructions

- Keep the `Swashbuckle.Core` package reference aligned with the API project's target framework and other legacy package dependencies.
- Configure Swagger document paths in the API startup configuration; client code should not assume a fixed documentation URL.
- Treat the generated Swagger document as the contract for API clients and documentation tools.
- Check generated documentation after changing controllers, routes, request models, or response models.

## Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Injected or called by (1)

- `Pams.API` — `Pams/API/Pams.API/Pams.API.csproj`:1
