Documentation Index
Fetch the complete documentation index at: https://docs.vertz.dev/llms.txt
Use this file to discover all available pages before exploring further.
@vertz/openapi generates a fully typed TypeScript SDK from any OpenAPI 3.x spec. It produces typed resource methods, TypeScript interfaces, and optional Zod schemas — powered by @vertz/fetch under the hood.
This page covers generating SDKs from external OpenAPI specs (third-party APIs, FastAPI
backends, etc.). For the SDK generated from your own Vertz entity definitions, see SDK & Fetch
Client.
Install
Quick start
Configuration
Create anopenapi.config.ts in your project root:
CLI options
| Flag | Description | Default |
|---|---|---|
--from <path-or-url> | Path to OpenAPI spec file or URL | Required (or use config) |
--output <dir> | Output directory | ./src/generated |
--base-url <url> | Default base URL for API calls | '' |
--group-by <mode> | Grouping: tag, path, none | tag |
--schemas | Generate Zod validation schemas | false |
--exclude-tags <t> | Comma-separated tags to exclude | none |
--dry-run | Preview without writing files | false |
Using the generated SDK
Install@vertz/fetch in the project that consumes the SDK:
Result<T, FetchError> — never throws for HTTP errors.
Operation ID normalization
Many backend frameworks generate verbose operationIds that include the full URL path. The generator provides three levels of control to produce clean, idiomatic method names.Auto-cleaning (default)
Without any configuration, the generator automatically:- Strips controller prefixes (e.g.,
TasksController_findAll→findAll) - Removes trailing HTTP method words (
listTasksGet→listTasks) - Detects CRUD patterns from the HTTP method and path shape
Framework adapters
Built-in adapters handle operationId quirks for common backend frameworks. Import from@vertz/openapi/adapters.
FastAPI
FastAPI generates operationIds by concatenating the function name, route path, and HTTP verb:fastapi() adapter strips the route+verb suffix, leaving just the meaningful function name:
| FastAPI operationId | Path | Result |
|---|---|---|
list_tasks_tasks_get | /tasks | list_tasks |
get_user_v1_users__id__get | /v1/users/{id} | get_user_v1 |
create_task_v2_tasks_post | /v2/tasks | create_task_v2 |
delete_task_tasks__id__delete | /tasks/{id} | delete_task |
get_bot_activities_web_...bot_activities_get | /web/organizations/{id}/... | get_bot_activities |
/v1/, /v2/, etc., the version is preserved in the method name.
NestJS
NestJS (@nestjs/swagger) generates operationIds like TasksController_findAll. The adapter strips the Controller prefix:
| NestJS operationId | Result |
|---|---|
TasksController_findAll | findAll |
UsersController.getById | getById |
Custom transform
For full control, provide atransform function that receives the auto-cleaned name and a full OperationContext:
Static overrides
For one-off renames, useoverrides — a map from raw operationId to desired method name:
Writing a custom adapter
An adapter is a function that returns{ transform }. You can write one for any backend framework:
Excluding tags
Skip internal or deprecated tags:Programmatic API
Supported specs
- OpenAPI 3.0.x and 3.1.x
- JSON and YAML formats
- File paths and URLs