Skip to content

v0.1.0

Latest
Compare
Choose a tag to compare
@Cstannahill Cstannahill released this 14 Sep 04:39
· 5 commits to main since this release
69bb623

πŸš€ 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 via typesync.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 file
  • validate (check) β€” Validate an OpenAPI schema
  • plugin β€” List and load plugins
  • init β€” 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 models
  • api-client.ts β€” axios client with typed inputs/outputs
  • hooks.ts β€” React hooks for queries/mutations
  • index.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 πŸŽ‰)