openapi-codegenlisted
Install: claude install-skill claude-dev-suite/claude-dev-suite
# OpenAPI Code Generation Core Knowledge
> **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology: `openapi-codegen` for comprehensive documentation.
## openapi-typescript (Types Only)
Generates TypeScript types from OpenAPI schemas. Lightweight, no runtime.
```bash
# Installation
npm install -D openapi-typescript
# Generate types
npx openapi-typescript ./openapi.yaml -o ./src/types/api.ts
npx openapi-typescript https://api.example.com/openapi.json -o ./src/types/api.ts
```
### Generated Types Usage
```typescript
import type { paths, components } from './types/api';
// Schema types
type User = components['schemas']['User'];
type CreateUserDto = components['schemas']['CreateUserDto'];
// Request/Response types
type CreateUserRequest = paths['/users']['post']['requestBody']['content']['application/json'];
type UserResponse = paths['/users/{id}']['get']['responses']['200']['content']['application/json'];
type UsersListResponse = paths['/users']['get']['responses']['200']['content']['application/json'];
// Path parameters
type UserPathParams = paths['/users/{id}']['get']['parameters']['path'];
```
### With openapi-fetch
```typescript
import createClient from 'openapi-fetch';
import type { paths } from './types/api';
const client = createClient<paths>({
baseUrl: 'https://api.example.com',
});
// Fully typed requests
const { data, error } = await client.GET('/users/{id}', {
params: { path: { id: '123' } },
});
const { data } = await client.POST(