fork of hey-api/openapi-ts because I need some additional things
1# Examples
2
3This directory contains integration examples demonstrating how to use `@hey-api/openapi-ts` with various frameworks, libraries, and client implementations.
4
5## Available Examples
6
7- **openapi-ts-angular** - Angular integration with common HTTP client
8- **openapi-ts-angular-common** - Angular with @angular/common/http
9- **openapi-ts-axios** - Using Axios client
10- **openapi-ts-fastify** - Fastify server integration
11- **openapi-ts-fetch** - Native Fetch API client
12- **openapi-ts-next** - Next.js integration
13- **openapi-ts-nuxt** - Nuxt.js integration with plugin
14- **openapi-ts-ofetch** - Using ofetch client
15- **openapi-ts-openai** - OpenAI API integration
16- **openapi-ts-pinia-colada** - Vue with Pinia Colada state management
17- **openapi-ts-sample** - Sample/template example (excluded from CI)
18- **openapi-ts-tanstack-angular-query-experimental** - Angular with TanStack Query
19- **openapi-ts-tanstack-react-query** - React with TanStack Query
20- **openapi-ts-tanstack-svelte-query** - Svelte with TanStack Query
21- **openapi-ts-tanstack-vue-query** - Vue with TanStack Query
22
23## Generated Code
24
25All examples (except `openapi-ts-sample`) contain generated client code that is **committed to the repository**. This ensures:
26
271. Examples always reflect the current state of the code generator
282. Changes to the code generator are visible in pull requests
293. CI can verify that examples are kept up-to-date
30
31## Regenerating Examples
32
33After making changes to the core packages, regenerate all example code:
34
35```bash
36pnpm examples:generate
37```
38
39This command will run `openapi-ts` for each example that has an `openapi-ts` script in its `package.json`.
40
41## Verifying Examples
42
43To check if all examples are up-to-date with the current codebase:
44
45```bash
46pnpm examples:check
47```
48
49This check is also run automatically in CI. If it fails, run `pnpm examples:generate` and commit the changes.
50
51## Running Examples
52
53Each example can be run individually using the `example` script:
54
55```bash
56# Run dev server for fetch example
57pnpm example fetch dev
58
59# Build fetch example
60pnpm example fetch build
61```
62
63Or directly using pnpm filters:
64
65```bash
66pnpm --filter @example/openapi-ts-fetch dev
67```
68
69## Creating New Examples
70
71When creating a new example:
72
731. Create a new directory in `examples/`
742. Add an `openapi-ts` script to `package.json`
753. Run `pnpm examples:generate` to create initial generated code
764. Commit both the source and generated code
775. The example will automatically be included in CI checks
78
79## Excluding Examples
80
81To exclude an example from CI (like `openapi-ts-sample`):
82
831. Remove the `openapi-ts` script from `package.json`, or
842. Update the exclusion filters in `package.json` scripts and `.github/workflows/ci.yml`