- ✓Open-source license (ISC)
- ✓Actively maintained (<30d)
- ✓Mature repo (>1y old)
- ✓Documented (README)
- !No description
git clone https://github.com/akintomiwa-fisayo/openapi-sync && cp openapi-sync/*.md ~/.claude/agents/Subagents overview
[](https://www.npmjs.com/package/openapi-sync)
[](https://github.com/akintomiwa-fisayo/openapi-sync/blob/main/LICENSE)
[](https://github.com/akintomiwa-fisayo/openapi-sync)
# OpenAPI Sync
**OpenAPI Sync** is a powerful developer tool that automates the synchronization of your API documentation with your codebase using OpenAPI (formerly Swagger) specifications. It generates TypeScript types, fully-typed API clients (Fetch, Next.js Fetch, Axios, React Query, SWR, RTK Query), endpoint definitions, runtime validation schemas (Zod, Yup, Joi), and comprehensive documentation from your OpenAPI schema—ensuring type safety from API specification through client implementation to runtime validation.
> 📘 **[Full documentation available at openapi-sync.com](https://openapi-sync.com)**
## Core Features
- ⚡ **Zero-Config Presets** - 10 pre-configured framework presets (React Query, SWR, Axios, Fetch, RTK Query, Next.js, Python) for instant setup
- 🔄 **Real-time API Synchronization** - Automatically syncs OpenAPI specs from remote URLs with configurable intervals
- 📝 **Automatic Type Generation** - Generates TypeScript interfaces for all endpoints with full nested support
- 🔐 **Runtime Validation** - Generate Zod, Yup, or Joi schemas from OpenAPI specs with all constraints preserved
- 🎯 **Interactive Setup Wizard** - Streamlined configuration with auto-enabled tag-based folder splitting
- 🛡️ **Enterprise Ready** - Error handling, validation, state persistence, and custom code preservation
- 📦 **Folder Splitting** - Organize code by tags or custom logic with aggregator files for easy imports
- 📚 **Rich Documentation** - JSDoc comments with cURL examples and inline usage guides
- 🤖 **Agent-Ready Endpoints** - Browse endpoints with pagination and path filtering, inspect deep endpoint details, and read generated types without reloading the spec
- 🩺 **Diagnostic Doctor** - Diagnostic health checks for config validity, spec accessibility, peer dependencies, cache, and folder write permissions
- 🧹 **Stale File Purge** - Manifest-based stale code detection and cleanup with dry-run support to prevent orphaned code
- 🔄 **Custom Code Injection** - Preserve your custom code between regenerations with protected sections
[View all features →](https://openapi-sync.com/docs#features)
## Installation
```bash
npm install openapi-sync
# or
npm install -g openapi-sync
# or use directly
npx openapi-sync
```
> ⚠️ **macOS Big Sur Users:** If you encounter an esbuild error (`Symbol not found: _SecTrustCopyCertificateChain`), install `esbuild@0.17.19` first. See [Troubleshooting](#troubleshooting) for details.
---
## 🤖 Using with AI Agents
All CLI commands and programmatic APIs are **agent-safe** — no interactive prompts, fully non-blocking. Use `--json` for machine-readable output and `--silent` to suppress logs.
> **Full agent reference:** [`llms.txt`](./llms.txt) — a structured discovery file for LLMs, Copilots, and MCP tools.
### Agent Quick-Start (no prompts)
```bash
# 1. Create config (all settings as flags — no stdin required)
npx openapi-sync init --no-interactive \
--api-name petstore \
--api-url https://petstore3.swagger.io/api/v3/openapi.json \
--output-folder ./src/api \
--client-type react-query \
--validation-library zod \
--config-format typescript \
--json
# Or for protected specs, configure auth directly on init:
npx openapi-sync init --no-interactive \
--api-name backend \
--api-url https://api.example.com/openapi.json \
--auth-type bearer \
--auth-token '${env.SPEC_TOKEN}' \
--preset react-query-zod \
--json
# 2. Validate config + specs before writing any files
npx openapi-sync validate --json
# 3. Sync — generate types, endpoints, and schemas
npx openapi-sync --json
# 4. Generate a typed API client
npx openapi-sync generate-client --type react-query --json
```
### Machine-Readable Output (`--json`)
Every command emits a single, pure JSON object to `stdout` when `--json` is passed, making it safe to pipe directly into `jq` or consume from automated agents. All human-readable progress logs are suppressed or directed to `stderr`.
```bash
$ npx openapi-sync --json
{
"success": true,
"apis": ["petstore"],
"filesWritten": ["src/api/petstore/types.ts", "src/api/petstore/endpoints.ts"],
"endpointCount": 20,
"warnings": [],
"errors": [],
"phases": {
"sync": { "filesWritten": ["src/api/petstore/types.ts", "src/api/petstore/endpoints.ts"], "endpointCount": 20 },
"client": { "filesWritten": [], "endpointCount": 20 }
}
}
```
```bash
$ npx openapi-sync validate --json
{
"valid": true,
"apis": { "petstore": { "valid": true, "endpointCount": 20 } },
"configErrors": []
}
```
```bash
$ npx openapi-sync list-endpoints --json
{
"petstore": [
{ "name": "getPetById", "method": "GET", "path": "/pet/{petId}", "tags": ["pet"], "summary": "Find pet by ID" },
{ "name": "addPet", "method": "POST", "path": "/pet", "tags": ["pet"], "summary": "Add a new pet" }
]
}
```
```bash
$ npx openapi-sync list-endpoints --api petstore --path-contains pet --limit 2 --offset 0 --json
```
```bash
$ npx openapi-sync get-endpoint --api petstore --operation-id getPetById --json
```
```bash
$ npx openapi-sync read-type --api petstore --type-name Pet --json
```
### Dry Run (preview without writing files)
Compact, fast previews of planned files:
```bash
npx openapi-sync --dry-run --json
npx openapi-sync generate-client --type fetch --dry-run --json
```
### Layouts & Output Directories
- **Flat Mode (Default):** When `folderSplit` is omitted or empty (`{}`), files are placed directly in the API folder (`endpoints.ts`, `types/index.ts`, `types/shared.ts`).
- **Tag-Split Mode:** Setting `folderSplit: { byTags: true }` organizes endpoints into tag subfolders (e.g. `{tag}/endpoints.ts`, `{tag}/types.ts`, `shared.ts`).
- **Custom Client Directory:** `clientGeneration.outputDir` (or CLI `--output`) is fully supported in both flat and folder-split layouts. In flat mode, clients are placed directly in `{outputDir}/clients.ts` (or `api.ts`), while in folder-split mode clients are placed in `{outputDir}/{tag}/client.ts` and aggregated at `{outputDir}/clients.ts`, with relative imports resolving back to your generated types and endpoints.
### Programmatic API (TypeScript)
```typescript
import {
ValidateConfig,
Init,
GenerateClient,
ListEndpoints,
GetEndpointDetails,
ReadGeneratedType,
Doctor,
Purge,
} from "openapi-sync";
// Pre-flight check — no files written
const validation = await ValidateConfig({ silent: true });
if (!validation.valid) throw new Error(JSON.stringify(validation));
// Diagnostic health check on config, specs, peer dependencies, and directories
const health = await Doctor({ silent: true });
console.log("Health check:", health.healthy ? "All checks passed" : "Issues detected");
// Inspect API surface with pagination and filtering
const endpoints = await ListEndpoints({
apiName: "petstore",
pathContains: "pet",
limit: 5,
offset: 0,
silent: true,
});
console.log(endpoints.petstore.length, "endpoints found");
// Inspect a single endpoint in full detail (4-tier fuzzy matching)
const detail = await GetEndpointDetails({ apiName: "petstore", operationId: "getPetById", silent: true });
console.log(detail.endpoint.path);
// Read an exact generated type declaration (with optional line pagination)
const typeDecl = await ReadGeneratedType({ apiName: "petstore", typeName: "Pet", silent: true });
console.log(typeDecl);
// Sync and get structured result
const syncResult = await Init({ silent: true });
if (!syncResult.success) throw new Error(JSON.stringify(syncResult));
console.log("Files written:", syncResult.filesWritten);
// Generate client
const clientResult = await GenerateClient({ type: "react-query", silent: true });
console.log(JSON.stringify(clientResult));
// Detect and purge stale files from disk
const purgeResult = await Purge({ yes: true, silent: true });
console.log("Purged files:", purgeResult.purged);
```
### Exit Codes
| Code | Meaning |
|------|---------|
| `0` | Success |
| `1` | Config error or validation failed |
| `2` | Network / spec fetch error |
| `3` | Generation / file write error |
### Agent-safe vs Interactive Commands
| Command | Agent-safe? | Description |
|---------|:-----------:|-------------|
| `npx openapi-sync` | ✅ | Sync specs, generate types, endpoints, schemas |
| `npx openapi-sync validate` | ✅ | Validate config + specs; no files written |
| `npx openapi-sync doctor` | ✅ | Diagnostic health check on config, network, peer deps, cache |
| `npx openapi-sync list-endpoints` | ✅ | List endpoints with filtering and pagination; no files written |
| `npx openapi-sync get-endpoint` | ✅ | Inspect detailed schema for one endpoint by operationId or name |
| `npx openapi-sync read-type` | ✅ | Read generated TypeScript declaration block |
| `npx openapi-sync generate-client` | ✅ | Generate typed API client (fetch, next-fetch, axios, react-query, swr, rtk-query) |
| `npx openapi-sync purge --yes` | ✅ | Remove stale generated files without prompting |
| `npx openapi-sync init --no-interactive` | ✅ | Create config file without prompts |
| `npx openapi-sync init` (no flag) | ❌ | Interactive wizard (requires stdin) |
---
## Quick Start
### Option 1: Interactive Setup (Recommended) 🎯
The easiest way to get started is with the interactive setup wizard:
```bash
npx openapi-sync init
```
The wizard will guide you through:
- 📝 Configuration file format selection (TypeScript, JSON, or JavaScript)
- 🌐 API specification source (URL or local file)
- 📁 Folder organization options (split by tags or custom logic)
- 🚀 Client generation options (React Query, SWR, Fetch, Axios, RTK Query)
- ✅ Validation library setup (Zod, Yup, Joi)
- 🔧What people ask about openapi-sync
What is akintomiwa-fisayo/openapi-sync?
+
akintomiwa-fisayo/openapi-sync is subagents for the Claude AI ecosystem with 1 GitHub stars.
How do I install openapi-sync?
+
You can install openapi-sync by cloning the repository (https://github.com/akintomiwa-fisayo/openapi-sync) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is akintomiwa-fisayo/openapi-sync safe to use?
+
Our security agent has analyzed akintomiwa-fisayo/openapi-sync and assigned a Trust Score of 82/100 (tier: Trusted). See the full breakdown of passed checks and flags on this page.
Who maintains akintomiwa-fisayo/openapi-sync?
+
akintomiwa-fisayo/openapi-sync is maintained by akintomiwa-fisayo. The last recorded GitHub activity is dated 2026-09-17, with 0 open issues.
Are there alternatives to openapi-sync?
+
Yes. On ClaudeWave you can browse similar subagents at /categories/agents, sorted by popularity or recent activity.
Deploy openapi-sync to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Add a badge to your README
Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.
[](https://claudewave.com/repo/akintomiwa-fisayo-openapi-sync)<a href="https://claudewave.com/repo/akintomiwa-fisayo-openapi-sync"><img src="https://claudewave.com/api/badge/akintomiwa-fisayo-openapi-sync" alt="Featured on ClaudeWave: akintomiwa-fisayo/openapi-sync" width="320" height="64" /></a>More Subagents
The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
The agent that grows with you
Java 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
The agent engineering platform.
Makes your AI agent think like the laziest senior dev in the room. The best code is the code you never wrote.