π v0.1.0 β First Public Release
This is the initial, production-ready release of TypeSync β a fully typed, extensible TypeScript generator for OpenAPI, with a great FastAPI experience.
TypeSync produces strongly typed models, a typed axios API client, and optional React hooks β customizable via a plugin system.
β¨ Features
-
OpenAPI v3 β TypeScript
Generate strongly typed models, a typed API client, and optional React hooks. -
Zero-config CLI
Sensible defaults with flexible configuration viatypesync.config.json
. -
Plugin system
Enable built-ins or implement your own:- Branded types
- Zod validation glue
- Performance monitoring
- Request deduplication
-
Naming control
Support for camelCase, snake_case, PascalCase, prefixes, suffixes, and filtering by paths/schemas. -
FastAPI-friendly
Works seamlessly with any OpenAPI schema file or URL.
π CLI Commands
generate
(gen
) β Generate types/client/hooks from URL or filevalidate
(check
) β Validate an OpenAPI schemaplugin
β List and load pluginsinit
β Create a starter configuration
Quick examples
# From a running FastAPI app
npx type-sync generate --url http://127.0.0.1:8000/openapi.json
# From a file
npx type-sync generate --file ./openapi-schema.json
π¦ Output
Depending on config flags, generation produces:
types.ts
β strongly typed modelsapi-client.ts
β axios client with typed inputs/outputshooks.ts
β React hooks for queries/mutationsindex.ts
β barrel exports
βοΈ Configuration (optional)
Example typesync.config.json
:
{
"outputDir": "./src/generated",
"generateTypes": true,
"generateApiClient": true,
"generateHooks": false,
"useStrictTypes": true,
"namingConvention": "camelCase",
"typePrefix": "API",
"typeSuffix": "",
"includePaths": [],
"excludePaths": [],
"includeSchemas": [],
"excludeSchemas": [],
"plugins": [
{ "name": "branded-types", "enabled": true },
{ "name": "zod-validation", "enabled": false }
]
}
π Security & CI
- CodeQL (v3) scanning enabled
- Security audit via
npm audit
- Integration test spins up a FastAPI server and generates live from
/openapi.json
- Docs auto-published to GitHub Pages (
gh-pages
)
π Docs & Getting Started
Install:
npm install -D @cstannahill/type-sync
Generate:
npx type-sync generate --url http://127.0.0.1:8000/openapi.json --output ./src/generated --hooks
Import:
import { APIUser } from "./src/generated/types"
import { apiClient } from "./src/generated/api-client"
import { useGetUser } from "./src/generated/hooks"
Docs: [README](https://github.com/Cstannahill/type-sync#readme)
Issues: [GitHub Issues](https://github.com/Cstannahill/type-sync/issues)
β οΈ Known Limitations
- Some advanced OpenAPI edge cases may require schema adjustments or custom plugins
- Generated hooks require React projects (omit
--hooks
otherwise)
π§ Breaking Changes
- None (first release π)