orval
БесплатноБез исполняемых скриптовНе проверенGenerate type-safe API clients, TanStack Query/SWR hooks, Zod schemas, MSW mocks, Hono server handlers, MCP servers, and SolidStart actions from OpenAPI specs…
от orval-labs★ 6 668 звёзд на GitHubОб этом скилле
Orval - OpenAPI to TypeScript Code Generator
Orval generates type-safe TypeScript clients, hooks, schemas, mocks, and server handlers from OpenAPI v3/Swagger v2 specifications.
Quick Start
Installation
npm install orval -D
# or yarn add orval -D
# or pnpm add orval -D
# or bun add orval -D
Minimal Configuration
import { defineConfig } from 'orval';
export default defineConfig({
petstore: {
input: {
target: './petstore.yaml',
},
output: {
target: './src/api/petstore.ts',
schemas: './src/api/model',
client: 'react-query',
},
},
});
Run
npx orval
npx orval --config ./orval.config.ts
npx orval --project petstore
npx orval --watch
Choosing Your Setup
Client Selection Guide
| Use Case | Client | httpClient | Notes |
|---|---|---|---|
| React with server state | react-query |
fetch or axios |
TanStack Query hooks |
| Vue 3 with server state | vue-query |
fetch or axios |
TanStack Query for Vue |
| Svelte with server state | svelte-query |
fetch or axios |
TanStack Query for Svelte |
| SolidJS standalone app | solid-query |
fetch or axios |
TanStack Query for Solid |
| SolidStart full-stack | solid-start |
native fetch | Uses query()/action() primitives |
| Angular with signals | angular-query |
angular |
Injectable functions, signal reactivity |
| Angular traditional | angular |
— | HttpClient services |
| React with SWR | swr |
fetch or axios |
Vercel SWR hooks |
| Lightweight / Edge | fetch |
— | Zero dependencies, works everywhere |
| Node.js / existing Axios | axios-functions |
— | Factory functions (default) |
| Axios with DI | axios |
— | Injectable Axios instance |
| Validation only | zod |
— | Zod schemas, no HTTP client |
| Backend API server | hono |
— | Hono handlers with Zod validation |
| AI agent tools | mcp |
— | Model Context Protocol servers |
Mode Selection Guide
single— Everything in one file. Best for small APIs.split— Separate files:petstore.ts,petstore.schemas.ts,petstore.msw.ts. Good for medium APIs.tags— One file per OpenAPI tag + shared schemas. Organizes by domain.tags-split— Folder per tag with split files. Best for large APIs. Recommended.
httpClient Option
For react-query, vue-query, svelte-query, and swr clients:
output: {
client: 'react-query',
httpClient: 'fetch', // 'fetch' (default) | 'axios'
}
For angular-query:
output: {
client: 'angular-query',
httpClient: 'angular', // Uses Angular HttpClient
}
Configuration Reference
Config Structure
import { defineConfig } from 'orval';
export default defineConfig({
[projectName]: {
input: InputOptions,
output: OutputOptions,
hooks: HooksOptions,
},
});
Multiple projects can share the same config file with different input/output settings.
Input Options
input: {
target: './spec.yaml', // Path or URL to OpenAPI spec (required)
override: {
transformer: './transform.js', // Transform spec before generation
},
filters: {
mode: 'include', // 'include' | 'exclude'
tags: ['pets', /health/], // Filter by OpenAPI tags
schemas: ['Pet', /Error/], // Filter by schema names
},
parserOptions: {
headers: [ // Auth headers for remote spec URLs
{
domains: ['api.example.com'],
headers: {
Authorization: 'Bearer YOUR_TOKEN',
'X-API-Key': 'your-api-key',
},
},
],
},
}
Output Options
output: {
target: './src/api/endpoints.ts', // Output path (required)
client: 'react-query', // Client type (see table above)
httpClient: 'fetch', // 'fetch' (default) | 'axios' | 'angular'
mode: 'tags-split', // 'single' | 'split' | 'tags' | 'tags-split'
schemas: './src/api/model', // Output path for model types
operationSchemas: './src/api/params', // Separate path for operation-derived types
workspace: 'src/', // Base folder for all files
fileExtension: '.ts', // Custom file extension
namingConvention: 'camelCase', // File naming: camelCase | PascalC
Установить orval в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл orval?
Generate type-safe API clients, TanStack Query/SWR hooks, Zod schemas, MSW mocks, Hono server handlers, MCP servers, and SolidStart actions from OpenAPI specs using Orval. Covers all clients (React/Vue/Svelte/Solid/Angular Query, Fetch, Axios), custom HTTP mutators, authentication patterns, NDJSON streaming, programmatic API, and advanced configuration.
Как установить скилл orval?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл orval запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic