···11+---
22+"@hey-api/openapi-ts": patch
33+---
44+55+fix(parser): expand schema deduplication by including validation constraints in type ID
+210
.github/copilot-instructions.md
···11+# Hey API OpenAPI TypeScript Codegen
22+33+OpenAPI TypeScript is a CLI tool and library for generating TypeScript clients, SDKs, validators, and schemas from OpenAPI specifications. This is a monorepo built with pnpm workspaces, Turbo build orchestration, and TypeScript.
44+55+**ALWAYS reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.**
66+77+## Working Effectively
88+99+### Prerequisites and Setup
1010+1111+- Install Node.js 20.19.0+ or 24.7.0+ (see `.nvmrc` for current version: 24.7.0)
1212+- Install pnpm globally: `npm install -g pnpm@10.15.1`
1313+- Clone the repository and run setup commands
1414+1515+### Bootstrap, Build, and Test
1616+1717+```bash
1818+# Install dependencies (takes ~1m 20s)
1919+pnpm install
2020+2121+# Build packages only (NEVER CANCEL - takes ~2m 15s - set timeout to 180+ seconds)
2222+pnpm build --filter="@hey-api/**"
2323+2424+# Build all including examples (NEVER CANCEL - takes ~5+ minutes - set timeout to 360+ seconds)
2525+pnpm build
2626+2727+# Run tests (takes ~1m 5s - set timeout to 120+ seconds)
2828+# NOTE: Some network-dependent tests may fail in sandboxed environments
2929+pnpm test
3030+3131+# Run linting (takes ~35s)
3232+pnpm lint
3333+3434+# Run type checking (NEVER CANCEL - takes ~1m 20s - set timeout to 120+ seconds)
3535+pnpm typecheck
3636+3737+# Format code (takes ~35s)
3838+pnpm format
3939+```
4040+4141+### Development Workflow
4242+4343+```bash
4444+# Start development mode for main package (watches for changes)
4545+pnpm --filter @hey-api/openapi-ts dev
4646+4747+# Start development server for examples (e.g., fetch example)
4848+pnpm --filter @example/openapi-ts-fetch dev
4949+# Server starts on http://localhost:5173/
5050+5151+# Run CLI tool directly
5252+node packages/openapi-ts/bin/index.cjs --help
5353+# or after building
5454+npx @hey-api/openapi-ts --help
5555+```
5656+5757+## Build and Test Details
5858+5959+### **CRITICAL BUILD TIMING**
6060+6161+- **NEVER CANCEL BUILD COMMANDS** - They may take 2-5+ minutes
6262+- `pnpm build --filter="@hey-api/**"`: ~2m 15s (packages only)
6363+- `pnpm build`: ~5+ minutes (includes docs and examples)
6464+- `pnpm install`: ~1m 20s
6565+- `pnpm test`: ~1m 5s
6666+- `pnpm typecheck`: ~1m 20s
6767+- `pnpm lint`: ~35s
6868+- `pnpm format`: ~35s
6969+7070+### Build Issues and Workarounds
7171+7272+- **Docs build may fail** due to pnpm version mismatch in VitePress - this is expected in some environments
7373+- Use `pnpm build --filter="@hey-api/**"` to build packages without docs
7474+- **Some tests may fail** in sandboxed environments due to network restrictions (OpenAPI spec downloads)
7575+- **Generated test files** in `packages/openapi-ts-tests/` contain auto-generated snapshots that may have linting warnings - this is expected
7676+- **Linting issues** in `.gen/snapshots/` directories are expected for generated code
7777+7878+## Validation
7979+8080+### Manual Testing Scenarios
8181+8282+After making changes, ALWAYS validate with these scenarios:
8383+8484+1. **CLI Functionality Test**:
8585+8686+ ```bash
8787+ # Test CLI help
8888+ node packages/openapi-ts/bin/index.cjs --help
8989+9090+ # Test CLI version
9191+ node packages/openapi-ts/bin/index.cjs --version
9292+9393+ # Test basic code generation with a simple OpenAPI spec
9494+ # Create a minimal test spec and generate client code
9595+ node packages/openapi-ts/bin/index.cjs -i path/to/spec.json -o ./test-output --plugins "@hey-api/client-fetch" "@hey-api/typescript"
9696+ ```
9797+9898+2. **Example Application Test**:
9999+100100+ ```bash
101101+ # Start fetch example and verify it loads
102102+ pnpm --filter @example/openapi-ts-fetch dev
103103+ # Should start on http://localhost:5173/
104104+ ```
105105+106106+3. **Development Mode Test**:
107107+ ```bash
108108+ # Start dev mode and make a small change to verify rebuilding
109109+ pnpm --filter @hey-api/openapi-ts dev
110110+ ```
111111+112112+### Pre-commit Validation
113113+114114+ALWAYS run these commands before committing or the CI will fail:
115115+116116+```bash
117117+# Use lint:fix to auto-fix issues (some warnings in generated test files are expected)
118118+pnpm lint:fix
119119+120120+# Run typecheck (can target specific packages with --filter)
121121+pnpm typecheck
122122+123123+# Run tests (some network tests may fail in sandboxed environments)
124124+pnpm test
125125+```
126126+127127+**NOTE**: Some linting warnings in generated test snapshot files (`.gen/snapshots/`) are expected and should be ignored. The `lint:fix` command will resolve actual source code issues.
128128+129129+## Repository Structure
130130+131131+### Key Packages
132132+133133+- `packages/openapi-ts/` - Main CLI tool and library
134134+- `packages/codegen-core/` - Core code generation utilities
135135+- `packages/custom-client/` - Custom HTTP client implementations
136136+- `packages/nuxt/` - Nuxt.js integration
137137+- `packages/vite-plugin/` - Vite plugin
138138+139139+### Examples
140140+141141+- `examples/openapi-ts-fetch/` - Fetch client example (React + Vite)
142142+- `examples/openapi-ts-angular/` - Angular client example
143143+- `examples/openapi-ts-tanstack-react-query/` - TanStack React Query integration
144144+- `examples/openapi-ts-vue/` - Vue.js integration
145145+- Plus many more framework-specific examples
146146+147147+### Configuration Files
148148+149149+- `pnpm-workspace.yaml` - Workspace configuration
150150+- `turbo.json` - Turbo build configuration
151151+- `package.json` - Root package with workspace scripts
152152+- `.nvmrc` - Node.js version specification
153153+154154+## Common Tasks
155155+156156+### Working with the Main Package
157157+158158+```bash
159159+# Install deps for main package
160160+pnpm --filter @hey-api/openapi-ts install
161161+162162+# Build main package only
163163+pnpm --filter @hey-api/openapi-ts build
164164+165165+# Test main package only
166166+pnpm --filter @hey-api/openapi-ts test
167167+168168+# Start dev mode for main package
169169+pnpm --filter @hey-api/openapi-ts dev
170170+```
171171+172172+### Working with Examples
173173+174174+```bash
175175+# List all example packages
176176+ls examples/
177177+178178+# Run specific example
179179+pnpm --filter @example/openapi-ts-fetch dev
180180+181181+# Build all examples
182182+pnpm build --filter="@example/**"
183183+```
184184+185185+### Debugging and Troubleshooting
186186+187187+- Check `turbo.json` for task dependencies and configuration
188188+- Use `pnpm list` to see installed packages
189189+- Use `pnpm why <package>` to understand dependency chains
190190+- Check individual package `package.json` files for available scripts
191191+192192+## CI/CD Pipeline
193193+194194+The repository uses GitHub Actions (`.github/workflows/ci.yml`):
195195+196196+- Tests on multiple Node.js versions (20.19.0, 22.12.0, 24.7.0)
197197+- Tests on multiple OS (macOS, Ubuntu, Windows)
198198+- Runs build, lint, typecheck, and test commands
199199+- Publishes preview packages on PRs
200200+201201+## Performance Expectations
202202+203203+- **Cold install**: ~1m 20s
204204+- **Cold build**: ~2-5m depending on scope
205205+- **Incremental builds**: ~30s in dev mode
206206+- **Test suite**: ~1m 5s
207207+- **Linting**: ~35s
208208+- **Type checking**: ~1m 20s
209209+210210+Remember: This is a complex monorepo with many dependencies. Be patient with build times and always use appropriate timeouts for long-running commands.
···11+// This file is auto-generated by @hey-api/openapi-ts
22+33+import * as z from 'zod/v4-mini';
44+55+export const zLocaleOrLanguage = z.union([
66+ z.string().check(z.length(5)),
77+ z.string().check(z.length(2))
88+]);
···11+// This file is auto-generated by @hey-api/openapi-ts
22+33+import { z } from 'zod';
44+55+export const zLocaleOrLanguage = z.union([
66+ z.string().length(5),
77+ z.string().length(2)
88+]);
···11+// This file is auto-generated by @hey-api/openapi-ts
22+33+import { z } from 'zod/v4';
44+55+export const zLocaleOrLanguage = z.union([
66+ z.string().length(5),
77+ z.string().length(2)
88+]);
···11+// This file is auto-generated by @hey-api/openapi-ts
22+33+import * as z from 'zod/mini';
44+55+export const zLocaleOrLanguage = z.union([
66+ z.string().check(z.length(5)),
77+ z.string().check(z.length(2))
88+]);
···11+// This file is auto-generated by @hey-api/openapi-ts
22+33+import { z } from 'zod/v3';
44+55+export const zLocaleOrLanguage = z.union([
66+ z.string().length(5),
77+ z.string().length(2)
88+]);
···11+// This file is auto-generated by @hey-api/openapi-ts
22+33+import { z } from 'zod';
44+55+export const zLocaleOrLanguage = z.union([
66+ z.string().length(5),
77+ z.string().length(2)
88+]);