Skip to content

Releases: Cstannahill/schemantic

v0.1.0

14 Sep 04:39
69bb623
Compare
Choose a tag to compare

🚀 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 🎉)