{"id":30642098,"url":"https://github.com/pixxiti/oax","last_synced_at":"2026-05-08T19:33:47.200Z","repository":{"id":309142912,"uuid":"1035286438","full_name":"pixxiti/oax","owner":"pixxiti","description":"Open API Spec validation and client generation tooling for Typescript","archived":false,"fork":false,"pushed_at":"2026-04-13T21:32:55.000Z","size":403,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-13T21:38:36.223Z","etag":null,"topics":["ky","oas","oas3","openapi","openapi3","react-query","tanstack-react-query","typescript","validation","zod"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pixxiti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-10T04:11:55.000Z","updated_at":"2026-04-13T21:32:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"1cf2396f-0738-4b27-b598-a6d3a0013e4a","html_url":"https://github.com/pixxiti/oax","commit_stats":null,"previous_names":["pixxiti/zoddy","pixxiti/oax"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pixxiti/oax","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixxiti%2Foax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixxiti%2Foax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixxiti%2Foax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixxiti%2Foax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pixxiti","download_url":"https://codeload.github.com/pixxiti/oax/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixxiti%2Foax/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32794716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ky","oas","oas3","openapi","openapi3","react-query","tanstack-react-query","typescript","validation","zod"],"created_at":"2025-08-31T02:02:13.151Z","updated_at":"2026-05-08T19:33:47.194Z","avatar_url":"https://github.com/pixxiti.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oax\n\n**Open API Spec validation and client generation tooling for Typescript**\n\noax is a TypeScript-first API client generator that creates fully type-safe HTTP clients with runtime validation using Zod schemas. It combines the power of OpenAPI specifications, Zod validation, and the ky HTTP client for a seamless development experience.\n\n## Features\n\n- 🚀 **Type-safe API clients** generated from OpenAPI specifications\n- ✅ **Runtime validation** of requests and responses using Zod schemas\n- 🛡️ **Automatic input/output validation** with developer-friendly error messages\n- 🔧 **Validation control** - enable/disable validation as needed\n- 🎯 **Zero configuration** - validation works out of the box\n- 📦 **Built on ky** - modern, lightweight HTTP client\n- 🔄 **Backwards compatible** - existing code continues to work\n\n## Quick Start\n\n### Packages\n\noax consists of three main packages:\n\n- **[@oax/core](./packages/core/)** - Core runtime library for API clients with validation\n- **[@oax/cli](./packages/cli/)** - Command-line tool for generating typed API clients from OpenAPI specs\n- **[@oax/hooks](./packages/hooks/)** - React Query v5 hooks for seamless React integration\n\n## Installation\n\n```bash\n# Core runtime library\nnpm install @oax/core\n\n# CLI for code generation\nnpm install -g @oax/cli\n\n# React hooks (requires React 18+ and TanStack Query v5)\nnpm install @oax/hooks @tanstack/react-query\n```\n\n### Package Manager Alternatives\n\n```bash\n# Using pnpm\npnpm add @oax/core\npnpm add -g @oax/cli\npnpm add @oax/hooks @tanstack/react-query\n\n# Using yarn\nyarn add @oax/core\nyarn global add @oax/cli\nyarn add @oax/hooks @tanstack/react-query\n```\n\n### Basic Usage\n\nGenerate your API client (validation enabled by default):\n\n```typescript\nimport { createClient } from './generated-client';\n\nconst client = createClient('https://api.example.com');\n\n// All requests and responses are automatically validated\nconst response = await client.getPet({ petId: 123 });\n```\n\n### Disable Validation\n\n```typescript\nconst client = createClient('https://api.example.com', {\n  validate: false // Turns off all validation\n});\n```\n\n## Validation Features\n\n### Automatic Input/Output Validation\n\n- **Request Parameters**: Validates path, query, and header parameters against their Zod schemas\n- **Request Body**: Validates request body data against Zod schemas\n- **Response Data**: Validates API response data against expected Zod schemas\n\n### Validation Control\n\n- **Default Behavior**: Validation is **enabled by default**\n- **Opt-out**: Pass `validate: false` to disable validation\n- **Custom Hooks**: Export validation helpers for custom ky hook configuration\n\n### Developer-Friendly Error Messages\n\n- Console-readable error format with emojis and detailed context\n- Shows validation path and specific error messages\n- Includes the actual data that failed validation\n\n## Advanced Usage\n\n### Custom Validation Hooks\n\n```typescript\nimport { \n  createValidationHelpers, \n  createKyValidationHooks, \n  ValidationError \n} from '@oax/core';\nimport { createClient } from './generated-client';\n\nconst helpers = createValidationHelpers();\nconst kyHooks = createKyValidationHooks(helpers);\n\n// Extend existing client with custom hooks\nconst client = createClient('https://api.example.com', {\n  validate: false // Turns off all validation\n  hooks: {\n    beforeRequest: [kyHooks.beforeRequest],\n    afterResponse: [kyHooks.afterResponse]\n  }\n});\n```\n\n## Error Handling\n\n### ValidationError Class\n\nWhen validation fails, a `ValidationError` is thrown with:\n\n- `type`: \"request\" or \"response\" \n- `operation`: The operation ID that failed\n- `zodError`: The underlying Zod validation error\n- `data`: The actual data that failed validation\n\n### Console Output Example\n\n```\n🚫 Request validation error in operation: createPet\n\nValidation errors:\n  • name: Required\n  • age: Expected number, received string\n\nData received: {\n  \"name\": \"\",\n  \"age\": \"invalid\"\n}\n```\n\n## Implementation Details\n\n### Validation Flow\n\n1. **Request Validation**: Before sending the request\n   - Validates parameters against their schemas\n   - Validates request body against schema\n   - Throws `ValidationError` if validation fails\n\n2. **Response Validation**: After receiving the response  \n   - Validates response data against expected schema\n   - Logs errors to console for debugging\n   - Returns validated data\n\n### Performance\n\n- Validation only runs when `validate: true` (default)\n- Uses Zod's efficient `safeParse` method\n- Minimal overhead when validation is disabled\n\n## API Reference\n\n### Exported Functions\n\n- `createValidationHelpers()`: Creates validation helper functions\n- `createKyValidationHooks(helpers)`: Creates ky hooks for validation\n- `ValidationError`: Error class for validation failures\n- `ValidationHelpers`: Interface for validation helper functions\n- `KyValidationHooks`: Interface for ky validation hooks\n\n## Examples\n\noax includes comprehensive examples to help you get started:\n\n- **[Basic Example](./examples/basic/)** - Complete implementation using the Petstore API with TypeScript\n- **[Hooks Example](./examples/hooks/)** - React integration with TanStack Query v5 hooks\n\nEach example includes:\n- Full working code with TypeScript\n- Generated API clients\n- Development server setup\n- Comprehensive documentation\n\n## Development\n\n### Prerequisites\n\n- Node.js \u003e= 18.0.0\n- pnpm (recommended package manager)\n\n### Setup\n\n```bash\n# Install dependencies\npnpm install\n\n# Build all packages\npnpm build\n\n# Run tests\npnpm test\n\n# Start development mode\npnpm dev\n```\n\n### Project Structure\n\n```\noax/\n├── packages/\n│   ├── core/           # Core runtime library (@oax/core)\n│   ├── cli/            # Code generation CLI (@oax/cli)\n│   └── hooks/          # React Query hooks (@oax/hooks)\n└── examples/\n    ├── basic/          # Basic TypeScript example\n    └── hooks/          # React hooks example\n```\n\n## Backwards Compatibility\n\nAll existing code continues to work without changes. Validation is additive and doesn't break existing functionality.\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpixxiti%2Foax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpixxiti%2Foax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpixxiti%2Foax/lists"}